diff --git a/lib/ui/settings/user_details.dart b/lib/ui/settings/user_details.dart index 28e45f6cf..cee533396 100644 --- a/lib/ui/settings/user_details.dart +++ b/lib/ui/settings/user_details.dart @@ -149,16 +149,20 @@ class _UserDetailsState extends State }); } else if (_connectGmailStep == GMAIL_1_SIGN_IN) { print('## STEP 1'); - GoogleOAuth.grantOfflineAccess((idToken, accessToken, serverAuthCode) { - print('## id: $idToken, acces: $accessToken, auth: $serverAuthCode'); - if (idToken.isEmpty || accessToken.isEmpty) { - GoogleOAuth.signOut(); - } else { - setState(() { - _connectGmailStep = GMAIL_2_AUTHORIZE; - }); - } - }); + try { + GoogleOAuth.grantOfflineAccess((idToken, accessToken, serverAuthCode) { + print('## id: $idToken, acces: $accessToken, auth: $serverAuthCode'); + if (idToken.isEmpty || accessToken.isEmpty) { + GoogleOAuth.signOut(); + } else { + setState(() { + _connectGmailStep = GMAIL_2_AUTHORIZE; + }); + } + }); + } catch (error) { + showErrorDialog(context: context, message: error); + } } else if (_connectGmailStep == GMAIL_2_AUTHORIZE) { print('## STEP 3'); final completer = Completer();