AxaFrance / oidc-client

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

Problem with token timer on older Andrid device #1154

Closed Landuu closed 1 year ago

Landuu commented 1 year ago

Issue and Steps to Reproduce

Hello, I've encountered a problem with token timer and overall token lifetime on older Android device, Zebra scanner running Android 8.1 and Chrome 68 to be exact. On desktop everything is running fine, but when I login from the scanner background token timer is set to ~3800 seconds. Token is not getting refreshed because oidc-clients thinks the token is still valid. Expected token lifetime in this case is 3mins.

I'm also getting a "Shared worker not available" warning in the console. Can this be fixed or is the browser version too old?

Versions

React Oidc: 7.6

Screenshots

OIDC_1

Landuu commented 1 year ago

Some additional info:

Token refresh after those 3800 seconds seems to work: image

Shared worker is probably not supported by the browser: image

guillaume-chervet commented 1 year ago

Hi @Landuu , thank you very much for your issue. I am not sure to understand your main problem:

What does look like your configuration? Doe you have a sample?

The SharedWorker error is look strange. I will look a the source code. It is not blocking because it will use defaut javascript timer instead of service worker or shared worker one.

Landuu commented 1 year ago

Token lifetime is invalid only on older android device (maybe because it's using timer instead of worker as you mentioned?).

As seen in first screenshot, token lifetime is set to 3min in Keycloak for test purposes. Everything works correctly on dekstop and an android phone with latest version of chrome where timer is counting from about 60.

Problem only occures on this older Zebra scanner where build-in token timer is counting from ~4000 seconds instead of 60.

Config is basically copied from docs with commented out service worker options.

Landuu commented 1 year ago

I found out that device unix time was out of sync, so the problem was on my side. Everything seems to work ok after changing time settings. Sorry for taking your time and thanks for quick response.