Closed TAMILSELVAN943 closed 2 years ago
If using this SDK we can get lineUserId:
final loginResult = await LineSDK.instance.login(scopes: ["profile", "openid", "email"]);
final lineUserId = loginResult.userProfile?.userId;
How we can get lineEmail?
The Email is contained in the idToken
in the "email" field, if the user set it in LINE. You can use this code to get it:
final result = await LineSDK.instance.login(scopes: ["profile", "openid", "email"]);
final idToken = result.accessToken.idToken;
final userEmail = (idToken != null) ? idToken['email'] : null;
Please be careful since the user can choose to not share his/her email with you, or he/she might even not yet set an email address bound to the LINE account, this value could be null
and you have to consider a way to handle it.
It is now a bit hard to use and not obvious. We will soon add a getter for the email address and release a new version for it.
Per #58, once it gets merged, you can use the email
to get it:
final result = await LineSDK.instance.login(scopes: ["profile", "openid", "email"]);
final userEmail = result.accessToken.email;
Per #58, once it gets merged, you can use the
final result = await LineSDK.instance.login(scopes: ["profile", "openid", "email"]); final userEmail = result.accessToken.email;
@onevcat there is no field .email after merging (already merged right?) but result.accessToken.idToken?['email']
has what i need, thank you!
Sorry for the confusion, it is not tagged/released yet. I meant you can use it from the next version of flutter_line_sdk
. I will prepare a tag for it today but it should be totally fine to just use your current way. They are the same.
Version 2.2.0 was just released with this change. Find more in the pub.dev or repo release page.
Is it a security issue?
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?
What did you expect?
What happened actually?
Your environment?
Sample project