oidc-client icon indicating copy to clipboard operation
oidc-client copied to clipboard

Client re-authenticates and reloads every couple seconds

Open danorlando opened this issue 1 year ago • 4 comments

My application is re-authenticating and reloading every couple seconds. I am testing out the react-oidc library with Auth0. The authentication is successful and the client receives a valid access token, but Its as if the client does not know that it is authenticated and so it continues trying to re-authenticate.

This is my configuration:

export const configurationAuth0 = {
  client_id: '7a76N12nFlJTGX6LPyO9WToZ9BqiVQjJ',
  redirect_uri: window.location.origin + '/authentication/callback',
  silent_redirect_uri: window.location.origin + '/authentication/silent-callback',
  scope: 'openid profile email api offline_access',
  authority: 'https://dev-6p6dxb6obb331271.us.auth0.com',
  service_worker_relative_url: '/OidcServiceWorker.js',
  service_worker_only: false,
  token_renew_mode: TokenRenewMode.access_token_invalid
};

I'll share a couple of screenshots that should be helpful in troubleshooting...

Here is the request made to the /authorize endpoint:

Screenshot 2023-04-18 at 8 17 43 AM

Here is the POST request made to the auth0 domain/oauth/token endpoint... (note that there is no response for this request) Screenshot 2023-04-18 at 8 19 22 AM

Response to request to get access token:

Screenshot 2023-04-18 at 8 23 01 AM

Token:

eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IkZaZXBTeHNSS2xHRFdfODVFUVFHdCJ9.eyJpc3MiOiJodHRwczovL2Rldi02cDZkeGI2b2JiMzMxMjcxLnVzLmF1dGgwLmNvbS8iLCJzdWIiOiJhdXRoMHw2NDAzYTU2OTgxOTg4MmYxNzBjYWM3MWMiLCJhdWQiOlsiaHR0cHM6Ly9jbG91ZGNoYXRhaS5jb20vIiwiaHR0cHM6Ly9kZXYtNnA2ZHhiNm9iYjMzMTI3MS51cy5hdXRoMC5jb20vdXNlcmluZm8iXSwiaWF0IjoxNjgxODU0NzU3LCJleHAiOjE2ODE5NDExNTcsImF6cCI6IjdhNzZOMTJuRmxKVEdYNkxQeU85V1RvWjlCcWlWUWpKIiwic2NvcGUiOiJvcGVuaWQgcHJvZmlsZSBlbWFpbCJ9.TcmGeFesjUXvn_rkajJBzH7ArL3MUbGnYDz8vCrxGlAL_QhBAYxYKYX3CBPV4EF2kFps0mJxlB1_HP-L_fLbmWvlsqlHcTqEw_BztMkpnmacgBFVoNLzw28QuYyqyXkg3y_aFxnWRj7h1TuB3lWnBHumg9dLdMZZV0iMk-4EFekeBp8keNNG_OTJHhKemqdOnCSJ1cE2XTfha8MZXKFs7AAC9NJfW9g8tciywLYActcLEZQCgBNIRdkF6dK1WLu8xYiWgiC3rL2snY_wRWfFcgPoG_pX7UmxmlgIfUCjn7lWtyI7aIVnzVAs-FkGJLgWgCTDxbDd1uea8guYOphE2Q

Decoded token:

Screenshot 2023-04-18 at 8 09 45 AM

If you want to try messing around with it yourself, this is the branch I'm working off of. If you do test it yourself, make sure to replace the config in client/src/auth/configs.js with the one shown above since it is pulling values from the .env, which is not committed to the repo.

It might also be worth mentioning that I tested this with the react-auth0 library to make sure there wasn't a configuration issue with the tenant in auth0 and everything worked as expected.

Originally posted by @danorlando in https://github.com/AxaFrance/react-oidc/issues/1033#issuecomment-1513274188

danorlando avatar Apr 18 '23 21:04 danorlando

Thank you @danorlando , it is my priority when i'am back from holidays.

guillaume-chervet avatar Apr 19 '23 20:04 guillaume-chervet

similar issue i am facing my application is doing authentication every 2-3 minutes which is refreshing the page which result into the lose of unsaved data on page. @guillaume-chervet do you have any update on this. here is my Issue. Please let me know if i am doing anything wrong.

mohitthakur23 avatar Jun 23 '23 14:06 mohitthakur23

Hi @danorlando , do you have as a text a full token response. I may need it to find the cause of the problem.

guillaume-chervet avatar Aug 02 '23 18:08 guillaume-chervet

Hi @danorlando , @mohitthakur23 , Any news about yours issues? Do you have a full token responses as example?

guillaume-chervet avatar Aug 07 '23 20:08 guillaume-chervet