Closed xuancelestial closed 3 years ago
Hi,
Yes. You can get the IdTokenRaw
from the AccessToken
in the login result. However, this is a raw ID token string (JWT) without parsed, so you need to convert it to a JSON and get its email
field manually. This is not convenient for now and we will add to our backlog! Before we can have a built-in way to parse it, you can try to find some other library or parse it yourself (Basically it is a base64 URL encoded string, and you can find a few existing libraries for this purpose.)
The detailed steps:
var scopes = new string[] {"profile", "openid", "email"};
LineSDK.Instance.Login(scopes, result => {
//...
}
var raw = result.AccessToken.IdTokenRaw; // Remember to check null.
var jwt = SomeJWTLib.convertToDictionary(raw);
var email = jwt["email"]; // Remember to check null. Users can choose not allow you access the email.
Thank you! will try it out
Is there anyway I could get user's email from this SDK?
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