Skip to content

Commit

Permalink
Fixed the issue that the unauthorized account could not log in to the…
Browse files Browse the repository at this point in the history
… application normally
  • Loading branch information
DaVinci9196 committed Dec 24, 2024
1 parent 014b037 commit f9429da
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ suspend fun performSignIn(context: Context, packageName: String, options: Google
}
Log.d(TAG, "id token requested: ${options?.isIdTokenRequested == true}, serverClientId = ${options?.serverClientId}, permitted = ${authManager.isPermitted}")
val idTokenResponse = getIdTokenManager(context, packageName, options, account)?.let {
it.isPermitted = authManager.isPermitted
it.isPermitted = authResponse.auth != null
consentResult?.let { result -> it.putDynamicFiled(CONSENT_RESULT, result) }
withContext(Dispatchers.IO) { it.requestAuth(true) }
}
val serverAuthTokenResponse = getServerAuthTokenManager(context, packageName, options, account)?.let {
it.isPermitted = authManager.isPermitted
it.isPermitted = authResponse.auth != null
consentResult?.let { result -> it.putDynamicFiled(CONSENT_RESULT, result) }
withContext(Dispatchers.IO) { it.requestAuth(true) }
}
Expand All @@ -135,7 +135,8 @@ suspend fun performSignIn(context: Context, packageName: String, options: Google
val expirationTime = min(authResponse.expiry.orMaxIfNegative(), idTokenResponse?.expiry.orMaxIfNegative())
val obfuscatedIdentifier: String = MessageDigest.getInstance("MD5").digest("$googleUserId:$packageName".encodeToByteArray()).toHexString().uppercase()
val grantedScopeList = authResponse.grantedScopes ?: idTokenResponse?.grantedScopes ?: serverAuthTokenResponse?.grantedScopes
val grantedScopes = grantedScopeList?.split(" ").orEmpty().map { Scope(it) }.toSet()
val grantedScopes = grantedScopeList?.split(" ").orEmpty().map { Scope(it) }.toMutableSet()
consentResult?.also { options?.scopeUris?.onEach { grantedScopes.add(it) } }
val (givenName, familyName, displayName, photoUrl) = if (options?.includeProfile == true) {
val databaseHelper = DatabaseHelper(context)
val cursor = databaseHelper.getOwner(account.name)
Expand Down

0 comments on commit f9429da

Please sign in to comment.