Receive Error "nonce mismatch, expected undefined, got: <value>" when Setting Up an Enterprise OIDC Connection Using Cognito
"description": "nonce mismatch, expected undefined, got: XXX"mYDXYLkqj2NUi7KZqM5IPSVtfWKTPLdyJsvk4C37XDFN1H_CZ3cqlPrmEv5hIe3zIBAvRWBaBuNBVLg4DyudNV2RSTA3wo3FA4tzQbuphKNcoVljQcMuvOpH792vqbLuH4XEnNz1qEcK5SIg1Z1XeSS-CxnHiqMeJeVPKwKd-xQ",
"details": {
"body": {},
"connection": "xxx-xxxxxx",
"error": {
"message": "nonce mismatch, expected undefined, got: mYDXYLkqj2NUi7KZqM5IPSVtfWKTPLdyJsvk4C37XDFN1H_CZ3cqlPrmEv5hIe3zIBAvRWBaBuNBVLg4DyudNV2RSTA3wo3FA4tzQbuphKNcoVljQcMuvOpH792vqbLuH4XEnNz1qEcK5SIg1Z1XeSS-CxnHiqMeJeVPKwKd-xQ",
"oauthError": "access_denied",
"type": "oauth-authorization"
},
This error is not seen in any other type of connection, such as SAML, ADFS, db connections, etc.
- Cognito
- Identity Providers
- Login Error
As a result, the error nonce mismatch, expected undefined, got: <value>, which makes sense because Auth0 was not expecting any nonce in return, so the 'expected undefined'
The workaround would consist of:
- Update the connection to accept a nonce parameter. This can be done by looking at the documentation.
- Once the connection has been updated to accept a dynamic parameter in the alias field as login_hint, this parameter needs to be included when making the call to the /authorize endpoint with the corresponding SDK. A nonce must be generated and included in the login_hint parameter