AxaFrance / oidc-client

Light, Secure, Pure Javascript OIDC (Open ID Connect) Client. We provide also a REACT wrapper (compatible NextJS, etc.).
MIT License
597 stars 160 forks source link

How to persist the state on refresh<Following the Redux Example> #634

Closed vishal1785 closed 2 years ago

vishal1785 commented 3 years ago

Sorry if I have raised this incorrectly.

Question: I have implemented the authentication with PingID and can successfully log in after authentication. I have multiple routes and pages and the OIDC user(reducer) state is lost on refresh. How do I maintain the state if I keep the checkSessionInterval for 60(I believe this is in minutes and keeps the session active for that time)

Versions

"@axa-fr/react-oidc-redux": "^3.1.6",

Additional Details

guillaume-chervet commented 3 years ago

Hi @vishal1785 , the user should still be logged after a refresh. I think that 60 is in seconds. Do you reproduce the problem with the repository redux demo?

guillaume-chervet commented 3 years ago

If you are using memory storage remove it in order to use the default storage

vishal1785 commented 3 years ago

Yes, It still exists.

lucascruz9494 commented 2 years ago

same here...I was using @axa-fr/react-oidc-context without any problems , but I had to change to redux , and when I refresh any page from my app, it goes do the authenticating page and stays there , freezed. If I use inMemoryWebStorage, when I refresh any page I will be send back to the authenticating page, it will authenticate and will send me to my endpoint. So It works , but it is not the behaviour that I need because I can't test this on cypress, because when I use "cy.visit()" it goes to the login page , the storage will reset and I can't visit my endpoint , going on a loop with the authenticating process

Any ideia on how to fix this?

TeckTn commented 2 years ago

I have the same issue with the Redux example, is like the /silent_callback is neved called on page reload. or mybe I missed something. It's very inconvinient to force IDP redirect on each page load.

Is there any plan to fix this, or any workaroud ?

I made a test with localStorage Store ? but my site is stuck with the message "Authenticating in progress" ("Authentification en cours")

guillaume-chervet commented 2 years ago

Hi, the v5 react context is fully compatible with redux. It resolve the problem ans is very simpler and ligther. I close the pullrequest. Feel free to reopen it if you need it!