Created
July 2, 2020 08:01
-
-
Save dllewellyn/ec872bd82a5ec06ec76a1e48d4eae86b 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 fun signin() { | |
lifecycleScope.launch(errorHandler { signup() }) { | |
val result = oneTapClient.suspendBeginSignInRequest(buildSignInRequest()) | |
loginResult.launch( | |
IntentSenderRequest.Builder(result.pendingIntent) | |
.build() | |
) | |
} | |
} | |
private fun buildSignInRequest() = BeginSignInRequest.builder() | |
.setPasswordRequestOptions( | |
BeginSignInRequest.PasswordRequestOptions.builder() | |
.setSupported(true) | |
.build() | |
) | |
.setGoogleIdTokenRequestOptions( | |
BeginSignInRequest.GoogleIdTokenRequestOptions.builder() | |
.setSupported(true) | |
// Your server's client ID, not your Android client ID. | |
.setServerClientId(getString(R.string.one_tap_client_id)) .setFilterByAuthorizedAccounts(true) | |
.build() | |
) | |
.build() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment