-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't get id_token in access token. #108
Comments
i'm running this in iOS, found token successfully but in android i can't even run it. do you face any similar issue?
|
Hi, @taqi92 @GinoLin980
Could you share your Hi, could you try reproducing the issue and checking for potential causes? Although the conversion code appears to be correct here, I would guess something is happening to prevent the ID token string being passed to Flutter side: |
final loginOption = LoginOption(false, 'normal'); // 設定登入選項
final result = await LineSDK.instance.login(scopes: ['profile', 'openid', 'email'], option: loginOption); // 執行登入
final accessToken = await LineSDK.instance.currentAccessToken; // 獲取當前的存取權杖
final profile = await LineSDK.instance.getProfile(); // 獲取用戶個人資料
setState(() {
_userEmail = result.accessToken.email; // PRINTED
_userProfile = result.userProfile; // UNUSED
_accessToken = accessToken;
_idToken = result.accessToken.idToken; // PRINTED
_userID = profile.userId; // PRINTED
_name = profile.displayName; // PRINTED
_profilePic = profile.pictureUrl; // PRINTED
});
--------
ElevatedButton(
onPressed: () => {
print(_userID),
print(_profilePic),
print(_name),
print(_userEmail),
print(_accessToken!.data),
print(_idToken)
},
child: Text('print') // 點擊按鈕時打印用戶資訊到控制台
) @onevcat |
@GinoLin980 Never mind! The code snippet you pasted is enough! |
After some initial investigation, it appears this issue only occurs when trying to access the “current token” on Android. You should still be able to retrieve a valid ID token string immediately after the login process: final result = await LineSDK.instance.login(scopes: _selectedScopes.toList(), option: loginOption);
final accessToken = await LineSDK.instance.currentAccessToken;
print("id token: " + (result.accessToken.idTokenRaw ?? "null"));
> I/flutter ( 8806): id token: eyJraWQiOiI3ZjMx... For now, if you need the raw ID token value (for verification purposes) or require the email, please retrieve it directly from the result immediately after login. We will investigate the missing ID token issue when using the currentAccessToken property further and determine if a fix is necessary. |
@onevcat |
Is it a security issue?
No.
If you believe you have discovered a vulnerability or have an issue related to security, please DO NOT open a public issue. Instead, send us a mail to dl_oss_dev@linecorp.com.
What did you do?
Used official example on this repo and my own version but deleted
requestCode
inhomepage.dart
. Both of them didn't return aid_token
, the scopes and permissions in developer console were set properly(region is set in Taiwan).What did you expect?
Expected to get an
id_token
. I want to use email andid_token
to send them to my backend, then useid_token
in my backend to retrieve email from LINE API(https://developers.line.biz/en/reference/line-login/#verify-id-token). Then compare the email user sent, and email stored in my database(if exists), and email from LINE API.What happened actually?
Printed result:
Result in example app:

Your environment?
Under android API 35 emulator with LineSDK 2.3.8. All the gradles and manifast remain the same as example app of this repo.
Sample project
Can be reproduced in official example of this repo.
The text was updated successfully, but these errors were encountered: