AxaFrance / oidc-client

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

Silent renew of tokens do not work #1368

Open nandeeshwar-p opened 1 month ago

nandeeshwar-p commented 1 month ago

I am using latest version of the package @axa-fr/react-oidc.

My requirement is to refresh access and I'd tokens, before the session expires if the user is actively using the application.

So, as pert of oidc configuration I have added refresh_time_before_tokens_expiration_in_second:300, and token_automatic_renew_mode:TokenAutomaticRenewMode.AutomaticBeforeTokensExpiration, even then the token renew doesn't happen silently, instead after session expiry, "Session lost" component is rendered.

I tried with service worker and without service worker, either way it didn't help.

Could you please let me know how to renew tokens(with/out sevice worker) without disturbing user activity

guillaume-chervet commented 1 month ago

hi @nandeeshwar-p ,

thank you for your issue. DO you have a sample of your configuration?

To refresh token, you should avec scope : access_offline or use silent signin.

guillaume-chervet commented 1 month ago

hi @nandeeshwar-p you manage to make it works?

nandeeshwar-p commented 4 weeks ago

@guillaume-chervet thanks for the response... How do we use silent signin, could you please share the example link or a code snippet....

guillaume-chervet commented 4 weeks ago

Hi @nandeeshwar-p , did you tried the demo? https://github.com/AxaFrance/oidc-client/blob/main/examples%2Freact-oidc-demo%2Fsrc%2FMultiAuth.tsx

It contains many example. Which framework are you using?

nandeeshwar-p commented 2 weeks ago

Code snippet related to my implementation

With this in palce, a call is made to fetch token with the code as null,and eventually it fails