okta-react-native icon indicating copy to clipboard operation
okta-react-native copied to clipboard

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

Open pdwaj opened this issue 1 year ago • 3 comments

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 avatar Feb 28 '24 12:02 pdwaj

The same issue. @pdwaj Did you have a chance to resolve it?

david-tabaka-guesty avatar Jan 02 '25 11:01 david-tabaka-guesty

@pdwaj I get the same -600 error. Did you happen to solve this problem?

johannha avatar Apr 01 '25 12:04 johannha

I was able to solve it by making a change in Authentication policy

Image

@johannha @david-tabaka-guesty

Vijay-Shinde-Nitor avatar Apr 02 '25 03:04 Vijay-Shinde-Nitor