oidc-client: Infinite loop of redirects after logging in

So I am trying to make a nextjs project using keycloack as authentication server and I am using this project to make it work, the problem is after I signin it will redirect me in an infinite loop.

steps to reproduce:

Run a Keycloak server and create a client app (The name you enter is the clientID) localhost_8080_admin_master_console_

Next clone the nextjs demo (From react-oidc) and change settings in the layout component to the links you can find at http://localhost:8080/realms/REALMNAME/.well-known/openid-configuration image

Now start the nextjs with “yarn dev” and go to localhost:3001 then login and it wil keep redirecting you

Versions

@axa-fr/react-oidc”: “^5.11.1”,

Screenshots

Being sent in console every redirect image

(laggy video) https://user-images.githubusercontent.com/26123873/178000395-1a0343a2-6741-403a-97ce-d7f496181f03.webm

Expected

Show me te page I have to login for.

Actual

Infinite redirecting

Additional Details

  • Installed packages:
  "dependencies": {
    "@axa-fr/react-oidc": "^5.11.1",
    "next": "latest",
    "react": "17.0.2",
    "react-dom": "17.0.2"
  }

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 27 (16 by maintainers)

Most upvoted comments

THank you very much @Copystrike for your big help 👍

Ayy, No problem! Thankyou a lot for fixing this, I can finally do some authentication with Keycloak!

Well this issue can be closed since the problem is fixed 😁, but will open a new one since I noticed another problem regarding another issue 😅.

Thank you very much for your vidéo, i think there is another part of the bug here https://github.com/AxaGuilDEv/react-oidc/blob/master/packages/react/src/oidc/core/routes/OidcRoutes.tsx I have to sleep, i will try to fix it tomorrow.

Tested but with no success. I made an video of me testing it, I also provided some info that could maybe help with fixing the issue. https://user-images.githubusercontent.com/26123873/178122243-730e72ca-eed7-4630-8003-71eb13285c19.mp4