Migration to Credential Manager for Sign-in process - #2755
Conversation
…:FlowCrypt/flowcrypt-android into issue_2531_Migrate_to_Credential_Manager
|
Current changes cover only sign-in action for the UI interaction case. But still is no available way to get idToken silently. And many tests will be disabled after these changes. I prefer not to update this library yet. I will wait for more functionality. |
# Conflicts: # FlowCrypt/build.gradle.kts
| IntentSenderRequest.Builder(pendingIntent.intentSender).build() | ||
| ) | ||
| } else { | ||
| continueAfterGoogleAuthorization() |
There was a problem hiding this comment.
it looks like here we don't check if Gmail access was granted during authorization, causing creation of FlowCrypt account without Gmail access. It should be better to require Gmail access here, so app will function correctly.
There was a problem hiding this comment.
Thanks for pointing this out. Currently, the authorization request contains only one non-sign-in scope: https://mail.google.com/. For a single non-sign-in scope, Google does not use granular consent—the user either grants or denies the entire request. Also, getAuthorizationResultFromIntent() returns a result only for successful authorization and throws an ApiException otherwise. Therefore, reaching continueAfterGoogleAuthorization() should currently imply that Gmail access was granted.
However, I agree that explicitly checking AuthorizationResult.grantedScopes would make this requirement clear and protect the flow if more scopes are added later. I’ll add this validation to both the no-resolution path and the activity-result path before continuing with account creation.
This PR migrates Google Sign-In from the deprecated Google Sign-In API to Credential Manager.
GetSignInWithGoogleOptionfor authentication.AuthorizationClientseparately for Gmail scope authorization.GoogleIdTokenCredential.silentSignIn()calls withGoogleAuthUtiltoken retrieval, including invalid-token eviction and retry.AccountEntitytests.close #2531
Tests (delete all except exactly one):
To be filled by reviewers
I have reviewed that this PR... (tick whichever items you personally focused on during this review):