AppAuth-Android icon indicating copy to clipboard operation
AppAuth-Android copied to clipboard

Sometimes Intent becomes null

Open cgkronos opened this issue 2 years ago • 1 comments

Hello there,

Configuration

  • Version: 0.11.1
  • Integration: (native(Kotlin),)
  • Identity provider: Custom

Description

We working in implementing Oauth in a webview for iOS and Android, since yesterday Oauth for Android don't work anymore, what we do:

val authRequest = AuthorizationRequest.Builder(
                mServiceConfiguration!!,
                "kronos-android",  // Client ID
                ResponseTypeValues.CODE,
                Uri.parse("kronos://oauth/callback") // Redirect URI
 ).setScope("auth").build()
 val service = AuthorizationService(this)
 val intent = service.getAuthorizationRequestIntent(authRequest)

var resultLauncher = registerForActivityResult(
            ActivityResultContracts.StartActivityForResult()) { result ->
            if (result.resultCode == Activity.RESULT_OK) {
                // parse result and perform action
                val value = result.data?.getStringExtra("input")
                myLog("OAuth executed")
                myLog("Intent $value")
                val authResponse = AuthorizationResponse.fromIntent(result.data!!)
                val authException = AuthorizationException.fromIntent(result.data)
                myLog("Resp $authResponse")
                myLog("Except $authException")
                mAuthState = AuthState(authResponse, authException)
                // Handle authorization response error here
                retrieveTokens(authResponse)
            }
        }
resultLauncher.launch(intent) 

and sometimes I have this Error Except AuthorizationException: {"type":0,"code":9,"errorDescription":"Response state param did not match request state"}

PS on iOS everything is OK

cgkronos avatar Apr 05 '22 16:04 cgkronos

@cgkronos we are facing the same issue. Do you have any updates?

Cantinaband avatar Jan 26 '23 11:01 Cantinaband