File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -149,8 +149,7 @@ class _HomePageState extends State<HomePage>
149149 .login (scopes: _selectedScopes.toList (), option: loginOption);
150150 final accessToken = await LineSDK .instance.currentAccessToken;
151151
152- final idToken = result.accessToken.idToken;
153- final userEmail = (idToken != null ) ? idToken['email' ] : null ;
152+ final userEmail = result.accessToken.email;
154153
155154 setState (() {
156155 _userProfile = result.userProfile;
@@ -167,6 +166,7 @@ class _HomePageState extends State<HomePage>
167166 await LineSDK .instance.logout ();
168167 setState (() {
169168 _userProfile = null ;
169+ _userEmail = null ;
170170 _accessToken = null ;
171171 });
172172 } on PlatformException catch (e) {
Original file line number Diff line number Diff line change @@ -97,4 +97,13 @@ class AccessToken {
9797 /// The expected authorization type when this token is used in a request
9898 /// header. Fixed to `Bearer` for now.
9999 String get tokenType => _data['token_type' ];
100+
101+ /// The email address set by the user. This value only exists when `idToken` is
102+ /// valid and the user has set the email address in LINE and agreed to share it
103+ /// with you. Both "openid" and "email" scopes are required to get the user email.
104+ ///
105+ /// If you are not applying an ID Token when login, or the user does not set
106+ /// the email for the LINE account, or the user refuses to grant your access,
107+ /// `null` is returned.
108+ String ? get email => idToken? ['email' ];
100109}
You can’t perform that action at this time.
0 commit comments