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

Refresh Token causes rerender #527

Closed rpetigny closed 2 years ago

rpetigny commented 4 years ago

Issue and Steps to Reproduce

Access token is correctly refreshed when expired. But if we have a context which expose an overrided version of fetch, the user inside is never update.

Versions

All

Expected

Fetch should get access_token from UserManager, not from its props

Actual

Fetch gets access_token from props, which are provided by a contextProvider

guillaume-chervet commented 4 years ago

Hi @rpetigny , i do not understand your problem. Do you have sample of code?

youf-olivier commented 4 years ago

After a complete discussion this problem is due to a bad using of a useState.

But they are the same problem of many ones. The withAuthentication force rerender when oidc user change (after a refresh). I'm on It from many times but I had to work more on It

guillaume-chervet commented 2 years ago

This is fixed in v4. https://www.npmjs.com/package/@axa-fr/react-oidc-context Hooks have been splitted in order to solve that problem.