Created
December 23, 2022 20:02
-
-
Save DmitrySikorsky/fd24ec849621170dae8c226143c1aca7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!kIsWeb && Platform.isAndroid) { | |
GoogleSignIn googleSignIn = GoogleSignIn( | |
scopes: <String>['email'], | |
); | |
try { | |
GoogleSignInAccount account = (await googleSignIn.signIn())!; | |
// Send the account.serverAuthCode to your server to exchange it for the token | |
await validateEmailWithGoogleAndLogin(account.serverAuthCode!); | |
// As we do not really use the sign in features of the plugin, | |
// we need to sign out the user after we get the email from the access token on the server, | |
// so next time the user signs out in the app, | |
// he won’t be silently signed in into the Google account and see the Google sign in page instead. | |
await googleSignIn.signOut(); | |
} catch (e) {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment