kinde-oss / kinde-auth-react

Kinde React SDK for frontend authentication flows
https://docs.kinde.com/developer-tools/sdks/frontend/react-sdk/
MIT License
50 stars 11 forks source link

Bug: React-SDK Doesn't incorporate force token refresh #57

Closed samirpdl closed 2 months ago

samirpdl commented 2 months ago

Prerequisites

Describe the issue

The React-SDK does not have forced token refresh, which is available in the JS SDK (https://github.com/kinde-oss/kinde-auth-pkce-js/blob/main/src/createKindeClient.ts#L213). This is causing issues related to another piece of code available in the JS SDK(https://github.com/kinde-oss/kinde-auth-pkce-js/blob/main/src/utils/isJWTActive/isJWTActive.ts#L6). The addition of LEEWAY doesn't immediately refresh the token; it waits for 60 seconds before refreshing. This causes issues when the token has just expired and there is an API request in progress that doesn't refresh. This can be resolved in two ways: Remove LEEWAY from the JS SDK or add a forceRefresh option to the react-sdk.

Library URL

https://github.com/kinde-oss/kinde-auth-react

Library version

4.0.2

Operating system(s)

macOS

Operating system version(s)

ALL

Further environment details

No response

Reproducible test case URL

No response

Additional information

No response

toanbuise commented 2 months ago

I am also facing a similar issue and hope someone can help resolve it. Thanks

samirpdl commented 2 months ago

Sent a PR : https://github.com/kinde-oss/kinde-auth-pkce-js/pull/77

DanielRivers commented 2 months ago

PR all merged and released version 4.0.4