openid / AppAuth-Android

Android client SDK for communicating with OAuth 2.0 and OpenID Connect providers.

Home Page:https://openid.github.io/AppAuth-Android

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

After changing device language gives login_required error

WK-shahnawaz-khan opened this issue · comments

Checklist:

  • I am using the latest release
  • I searched for existing GitHub issues
  • I read the documentation
  • I verified the client configuration matches the information in the identity provider (or I am using dynamic client registration)
  • I am either using a custom URI scheme or https with App Links for client redirect.
  • I can reproduce the issue in the demo app (optional)

Configuration

  • Version: 0.11.1
  • Integration: (native(Kotlin))
  • Identity provider: (Auth0)

Issue Description

I have successfully logged in with OAuth2 and everything working fine. but as soon as I change device language and when i try to authenticate it gives me AuthorizationException: {"type":1,"code":1008,"error":"login_required"} in android API 33, however same process working fine in API 30 and below

code snippet

val authRequestBuilder = AuthorizationRequest.Builder(
            authServiceConfiguration(),
            configs.client_ID
            ResponseTypeValues.CODE,
            Uri.parse(configs.callback_url) // Redirect URI
        ).setScope("openid profile offline_access")
            .setState("12345678")
            .setClientId(configs.client_ID)
            .setPrompt(AuthorizationRequest.Prompt.NONE)
            .setAdditionalParameters(mapOf(Pair("additional_param", "id")))
            .build()

        authService = AuthorizationService(context)
        val authIntent =  authService.getAuthorizationRequestIntent(authRequestBuilder)

authResultLauncher.launch(authIntent)


 private val authResultLauncher =
        registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
            val data: Intent? = result.data
            data?.let {
                val authorizationResponse = AuthorizationResponse.fromIntent(it)
                val exception = AuthorizationException.fromIntent(data)
                if (result.resultCode == Activity.RESULT_OK) {
                    if (authorizationResponse != null) {
                     // business logic
                    } else {
                   // exception
                    }
                } else {
                 // exception
                }
            } ?: kotlin.run {
                // exception
            }
        }