Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth: Fixed the authorization issue #2698

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading