Created
July 2, 2020 08:01
-
-
Save dllewellyn/d2bc0822ef6e9d23457eb6ef75ede748 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
private val loginResult = | |
registerForActivityResult(ActivityResultContracts.StartIntentSenderForResult()) { | |
val credential = oneTapClient.getSignInCredentialFromIntent(it.data) | |
val idToken = credential.googleIdToken | |
val username = credential.id | |
val password = credential.password | |
when { | |
idToken != null -> { | |
// Got an ID token from Google. Use it to authenticate | |
// with your backend. | |
Log.d(TAG, "Got ID token.") | |
} | |
password != null -> { | |
// Got a saved username and password. Use them to authenticate | |
// with your backend. | |
Log.d(TAG, "Got password.") | |
} | |
else -> { | |
// Shouldn't happen. | |
Log.d(TAG, "No ID token or password!") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment