oidc-client: Error: Tokens are not OpenID valid

Issue and Steps to Reproduce

Receiving the following error during authentication: “Error: Tokens are not OpenID valid”

Versions

@axa-fr/react-oidc v6.14.6

Screenshots

Screenshot 2023-02-17 104122

Additional Details

I’m migrating from @axa-fr/react-oidc-context v3.1.7 where authentication was previously working with AD FS OpenId Connect. Here is my configuration:

const configuration: OidcConfiguration = {
  client_id: `${process.env.REACT_APP_CLIENT_ID}`,
  redirect_uri: \`${process.env.REACT_APP_BASEURL}auth`,
  scope: 'openid profile email',
  authority: `${process.env.REACT_APP_OIDC_URL}`,
  silent_redirect_uri: `${process.env.REACT_APP_BASEURL}authentication/silent_callback`,
  silent_login_uri: `${process.env.REACT_APP_BASEURL}authentication/silent_login`,
  service_worker_relative_url: '/OidcServiceWorker.js',
  service_worker_only: false
}

const adfsConfig: AuthorityConfiguration = {
  issuer: `${process.env.REACT_APP_OIDC_URL}`,
  authorization_endpoint: `${process.env.REACT_APP_OIDC_URL}/oauth2/authorize`,
  token_endpoint: `./proxy/proxy.ashx?${process.env.REACT_APP_OIDC_URL}/oauth2/token`,
  userinfo_endpoint: `${process.env.REACT_APP_OIDC_URL}/userinfo`,
  end_session_endpoint: `${process.env.REACT_APP_OIDC_URL}/oauth2/logout`,
  revocation_endpoint: `${process.env.REACT_APP_OIDC_URL}/oauth2/logout`,
}

Code for getting configuration based on environment was removed for brevity.

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 24 (12 by maintainers)

Most upvoted comments

@guillaume-chervet I face this error on 7.3.1 too! On debugging I find that the nonce set in the localstorage is different from the one received on POST /tokens when I decode the JWT token received for idToken. Apparently, we don’t use idToken and therefore the line of code that you pointed out may not be required for us. Is there a way to avoid this check through an arg?

@hagenderouen DO you still have the validation error? I have added a lot more error log detail in lastest version.

@franher last oidc version readme explain how to update files. I hope in a better way than before.

I got this error when I updated the package but did not update the service worker. @hagenderouen can you make sure you have the same version of the package and service worker?