Created
February 22, 2023 16:37
-
-
Save tdcolvin/c237dd7ed8e99757e92297430e84ecf9 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
//Tell the credential library that we're only interested in password credentials | |
val getCredRequest = GetCredentialRequest( | |
listOf(GetPasswordOption()) | |
) | |
//Show the user a dialog allowing them to pick a saved credential | |
val credentialResponse = credentialManager.getCredential( | |
request = getCredRequest, | |
activity = activity, | |
) | |
//Return the selected credential (as long as it's a username/password) | |
return credentialResponse.credential as? PasswordCredential |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment