Skip to content

Commit

Permalink
optmize code
Browse files Browse the repository at this point in the history
  • Loading branch information
aman-alfresco committed Nov 29, 2024
1 parent 28a1870 commit 2d29ea1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions auth/src/main/java/com/alfresco/auth/pkce/PkceAuthService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,11 @@ internal class PkceAuthService(context: Context, authState: AuthState?, authConf
Uri.parse(authConfig.redirectUrl)
)

if (authConfig.scope.isNotEmpty()) {
builder.setScope(authConfig.scope)
if (authConfig.authType == AuthTypeProvider.NEW_IDP) {
authConfig.scope.takeIf { it.isNotEmpty() }?.let { builder.setScope(it) }
authConfig.additionalParams.takeIf { it.isNotEmpty() }?.let { builder.setAdditionalParameters(it) }
}

if (authConfig.additionalParams.isNotEmpty()) {
builder.setAdditionalParameters(authConfig.additionalParams)
}

return builder.build()
}
Expand Down

0 comments on commit 2d29ea1

Please sign in to comment.