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

Automatic token renewal with a maximum delay between 2 triggers

Open TheMaskedTurtle opened this issue 1 year ago • 3 comments

I am trying to prevent a session cookie to expire before the token are renewed. This could happen when the tokens have a longer TTL than the cookie session, then we can longer perform a silent renew of the tokens.

Is there a way to prevent that with the current API ?

Otherwise, would it be possible to add a new parameter in the OidcConfiguration to configure this maximum delay between 2 token renew processes ?

TheMaskedTurtle avatar Dec 14 '23 15:12 TheMaskedTurtle

Hi @TheMaskedTurtle ,

Thank you for your issue. You can configure the behavior by using https://github.com/AxaFrance/oidc-client/blob/9f1f7f684a6b344f59221caf3e3a14faef73a6bc/packages/react-oidc/README.md?plain=1#L188 Property.

If your token expirer after 1000 seconds and you set it to 400 Your token will be refreh after 600 seconds.

guillaume-chervet avatar Dec 14 '23 17:12 guillaume-chervet

Hi @guillaume-chervet,

Thanks for your quick answer :)

Indeed it will do the trick. But it requires to know the token duration before configuring the application which is not necessarily the case. That's why ideally this parameter would not depend on the token duration itself.

TheMaskedTurtle avatar Dec 15 '23 10:12 TheMaskedTurtle

Hi @TheMaskedTurtle , i understand your need. I need to think because i do not know how to resolve this.

guillaume-chervet avatar Dec 16 '23 06:12 guillaume-chervet