Skip to content

[IOS] Microsoft authorize error: State mismatch #480

@zvs001

Description

@zvs001

Issue

Error appears, when I enter my login and click next. (before password)
It works ok for android, but not for IOS.

Error:

authentication_failed Error: State mismatch, expecting lyHmYsWJIfzKJvNMmzKDxAKG0hD6UpjxSvyWEJOoCtk 
but got (null) in authorization response
<OIDAuthorizationResponse: 0x600001fc7840, authorizationCode: (null), 
state: "(null)", accessToken: "(null)", accessTokenExpirationDate: (null),
 tokenType: (null), idToken: "(null)", scope: "(null)", 
additionalParameters: {
}, request: <OIDAuthorizationRequest: 0x600001769d50, request: https://login.microsoftonline.com/common/oauth2/v2.0/authorize?nonce=zdl9tBuq-v_TjxROBHlL-b2qjwQllnTtvcfU8j7lEHg&response_type=code&code_challenge_method=S256&scope=openid%20profile%20email%20https://graph.microsoft.com/.default&code_challenge=3NlCf9cav2xBNPk6WlxlRl7ZN7OxbfJwqtAPVvnMigo&redirect_uri=urn:ietf:wg:oauth:2.0:oob&client_id=xxxxx&state=lyHmYsWJIfzKJvNMmzKDxAKG0hD6UpjxSvyWEJOoCtk>>

Code:

const config = {
  issuer: 'https://login.microsoftonline.com/f375d31a-5e19-4a6e-b248-49c36fe91184/v2.0',
  clientId: 'xxxxx',
  redirectUrl: Platform.OS === 'ios' ? 'urn:ietf:wg:oauth:2.0:oob' : 'app://react-native-auth',
  scopes: ['openid', 'profile', 'email', 'https://graph.microsoft.com/.default'],
  serviceConfiguration: {
    authorizationEndpoint: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
    tokenEndpoint: 'https://login.microsoftonline.com/common/oauth2/v2.0/token',
  },
}


Environment

  • Your Identity Provider: Azure
  • Platform that you're experiencing the issue on: iOS
  • Are you using Expo? No

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions