Skip to content

Commit

Permalink
Auth: Correctly handle permission for requests with token request opt…
Browse files Browse the repository at this point in the history
…ions (microg#2322)
  • Loading branch information
DaVinci9196 authored Apr 29, 2024
1 parent 85571d9 commit 510b1e1
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ fun getServerAuthTokenManager(context: Context, packageName: String, options: Go

suspend fun performSignIn(context: Context, packageName: String, options: GoogleSignInOptions?, account: Account, permitted: Boolean = false): GoogleSignInAccount? {
val authManager = getOAuthManager(context, packageName, options, account)
if (permitted) authManager.isPermitted = true
val authResponse = withContext(Dispatchers.IO) {
if (options?.includeUnacceptableScope == true) {
authManager.setTokenRequestOptions(consentRequestOptions)
}
if (permitted) authManager.isPermitted = true
authManager.requestAuth(true)
}
var consentResult:String ?= null
Expand All @@ -110,7 +110,7 @@ suspend fun performSignIn(context: Context, packageName: String, options: Google
} else {
if (authResponse.auth == null) return null
}
Log.d(TAG, "id token requested: ${options?.isIdTokenRequested == true}, serverClientId = ${options?.serverClientId}")
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
consentResult?.let { result -> it.putDynamicFiled(CONSENT_RESULT, result) }
Expand Down

0 comments on commit 510b1e1

Please sign in to comment.