Error: Authorization Error: Unexpected response format while retrieving authorization code. Status code: 200
Implementation flow using methods of the package
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] }
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?
- Using method - getAuthClient().signInWithCredentials({ username, password })
- After receiving MFA_REQUIRED in response then from response calling verify link to verify email that will send OTP on email
- 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...', <....>}
- 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
The same issue. @pdwaj Did you have a chance to resolve it?
@pdwaj I get the same -600 error. Did you happen to solve this problem?
I was able to solve it by making a change in Authentication policy
@johannha @david-tabaka-guesty