File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -241,8 +241,22 @@ void OnSignInSuccessful(GoogleSignInAccount userAccount)
241241 if ( userAccount . GrantedScopes != null && userAccount . GrantedScopes . Count > 0 )
242242 {
243243 var scopes = $ "oauth2:{ string . Join ( ' ' , userAccount . GrantedScopes . Select ( s => s . ScopeUri ) . ToArray ( ) ) } ";
244-
245- _accessToken = GoogleAuthUtil . GetToken ( Application . Context , userAccount . Account , scopes ) ;
244+ System . Console . WriteLine ( $ "Scopes: { scopes } ") ;
245+ var tcs = new TaskCompletionSource < string > ( ) ;
246+ Task . Run ( ( ) =>
247+ {
248+ try
249+ {
250+ tcs . TrySetResult ( GoogleAuthUtil . GetToken ( Application . Context , userAccount . Account , scopes ) ) ;
251+ }
252+ catch ( Exception ex )
253+ {
254+ tcs . TrySetResult ( string . Empty ) ;
255+ System . Console . WriteLine ( $ "Ex: { ex } ") ;
256+ }
257+ } ) ;
258+
259+ _accessToken = await tcs . Task ;
246260
247261 System . Console . WriteLine ( $ "Access Token: { _accessToken } ") ;
248262 }
You can’t perform that action at this time.
0 commit comments