Unable to login

Login with X credentials and logout. Trying to login with Y credentials, unable to login into okta.

This is the error response as the result of calling the authenticate method.
APIError : “Authorization Error: Unexpected response format while retrieving authorization code. Status code:200”

Here’s how I get the session token:

OktaAuthSdk.authenticate(with:{okta domain}, username: {user name}, password: {password}, onStatusChange: { (status) in
}) {(error) in

Access token is obtained like below and the failure happens here:

oidcClient.authenticate(withSessionToken: sessionToken, callback: {stateManager, error in

On logout
dClient.signOut(with: [.revokeAccessToken, .removeTokensFromStorage, .revokeRefreshToken, .revokeTokensOptions], authStateManager: stateManager, from: UIViewController()) { currentOption in

} completionHandler: { success, failedOptions in


SDK Version(s)


Screenshot 2022-05-10 at 6.17.55 PM


Assuming this is the SDK being used in a classic Okta Org.
This most likely means that an html page instead of Json is being returned.

  • This can happen if you have application level MFA setup for the application.
  • If the user has not logged into Okta before and needs to set their security question.
  • User not assigned to the app
  • etc

Since one user works and the other doesn’t check if one user is setup for application level MFA for this app. You might also try navigating to your Okta Org and logging in as the user to see if the need to fill out an initial security question, or setup MFA if they have never logged in before.


Hi erik,

Thanks for answering my question.

Yes, as per your Point 1, my app is MFA enable. But which is smoothly works in android. In android they can login n number of users.

Point 2. while registering it self, we are asking security question.

Point 3. After successfully register and am able to login into okta. But unable to see that in my app.

Please elaborate it more. Is there any possibility to via a call to discuss about this issue.

Thanks in advance

To setup a call with Okta Support you will need to open a support case.