Skip to content
This repository has been archived by the owner on Jan 28, 2022. It is now read-only.

Improve robustness of expired token handling #72

Open
Svarto opened this issue Apr 26, 2021 · 0 comments
Open

Improve robustness of expired token handling #72

Svarto opened this issue Apr 26, 2021 · 0 comments

Comments

@Svarto
Copy link
Contributor

Svarto commented Apr 26, 2021

I have an edge case in React Native where when a notification is clicked by a user, that navigates quickly to a specific screen, then if the app is backgrounded and the JWT token has already expired then that expired JWT token is used in that first request. Resulting in a "JWT token expired" error from Hasura.

I suspect this is due to auth.getJWTToken() pulls the JWT token from storage before it is updated or refreshed through the refresh token.

There are potential solutions to this that I can think of:

  • [Backward compatible] Expose a method to programmatically refresh the JWT Token with the refresh token, this will allow the client app to handle these errors by retrying the request after forcing a JWT Token refresh
  • [Potentially breaking change] Make it so that auth.getJWTToken() halts return, or returns null, until the JWT Token has been refreshed

Just my ideas above, might be other ways. Looking forward to hearing what your thoughts are on this one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant