Skip to content

Instantly share code, notes, and snippets.

@bkhezry
Created December 29, 2018 17:06
Show Gist options
  • Save bkhezry/8d461c54de067327ef8376bd1261b76c to your computer and use it in GitHub Desktop.
Save bkhezry/8d461c54de067327ef8376bd1261b76c to your computer and use it in GitHub Desktop.
//Request google sign in
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, RC_SIGN_IN);
//Get selected account data
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RC_SIGN_IN) {
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
GoogleSignInAccount acct = result.getSignInAccount();
//TOKEN
String token = acct.getIdToken();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment