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

Error: Authorization Error: Unexpected response format while retrieving authorization code. Status code: 200 #416

Open
pdwaj opened this issue Feb 28, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@pdwaj
Copy link

pdwaj commented Feb 28, 2024

Implementation flow using methods of the package

Screenshot 2024-03-06 at 1 21 21 PM

Describe the bug?

[iOS and android issue]

MFA enabled using password + email factor to authenticate all the verification got successful and getting below response.

{"expiresAt":"",
"status":"SUCCESS",
"sessionToken":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"_embedded":{
"user":{
"id":"xxxxxxxx",
"profile":{
"login":"xxxx",
"firstName":"xxxx",
"lastName":"xxxx",
"locale":"xxxx",
"timeZone":"xxxxxxxx"
}}},"
_links":{
"cancel":{
"href":"${domainURL}/api/v1/authn/cancel",
"hints":{
"allow":["POST"]
}}}}

after passing session token from above response to authenticate method of this package as shown below

await authenticate({ sessionToken })

then getting below error
{
"code": -600,
"message": [Error: Authorization Error: Unexpected response format while retrieving authorization code. Status code: 200]
}

Simulator Screenshot - iPhone SE (3rd generation) - 2024-02-28 at 16 36 37

Note: A day before it is working and this error facing sometimes. Now, facing this issue consistently and unable login even a single time. I have check report logs on okta dashboard after MFA successfull the token has granted to the user. but still authenticate method throwing this error.

What is expected to happen?

if sessionToken is valid below method should not throw any error and successfully authenticate the user.

await authenticate({ sessionToken });

response should be like below

{
resolve_type: 'authorized',
access_token: 'XXX...',
<...>,
}

What is the actual behavior?

calling below method with valid session token
await authenticate({ sessionToken })

then getting below error (Error detailed screenshot attached at "Describe the bug?" section)
{
"code": -600,
"message": [Error: Authorization Error: Unexpected response format while retrieving authorization code. Status code: 200]
}

Reproduction Steps?

  1. Using method - getAuthClient().signInWithCredentials({ username, password })
  2. After receiving MFA_REQUIRED in response then from response calling verify link to verify email that will send OTP on email
  3. After receiving MFA_CHALLENGE in response then from sending calling verify link to verify with passCode which gives the below response
    {"expiresAt":"",
    "status":"SUCCESS",
    sessionToken: 'xxx...',
    <....>}
  4. Using session token from above response, calling method - await authenticate({ sessionToken })
    then getting the error (Error detailed screenshot attached at "Describe the bug?" section)
    {
    "code": -600,
    "message": [Error: Authorization Error: Unexpected response format while retrieving authorization code. Status code: 200]
    }

Additional Information?

Solution tried

  • Detaching debugger
  • Upgrading and downgrading "@okta/okta-react-native" package
  • Tried with multiple users
  • Tried on different emulators and simulator
  • Tried with changing MFA in policies but for MFA facing this issue and if only password policy apply then working as expected.
  • Verify report logs on Okta dashboard after MFA successful, token has granted to the user

SDK Version

versions

"@okta/okta-react-native": "2.10.0",
"react-native": "0.71.13",
node: v21.6.1

Build Information

No response

@pdwaj pdwaj added the bug Something isn't working label Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant