Skip to content

Cannot refresh token after close/reopen of browser #12

Description

@justinhrobbins

Hi, thanks for posting the token refresh solution in and detailing it in your blog post Add Google Login to your React Apps in 10 mins.

One question/comment:
The timer solution works well if the user keeps the browser open. Expired JWTs are refreshed as expected. However, as far as I can tell this doesn't address the following scenario:

  • User logs in via browser. This starts the refresh timer and we are able to refresh the token as long as the browser remains open. Nice!
  • User closes browser
  • User later re-opens the browser and navigates to our app
  • We retrieve the authToken from localStorage

At this point, we have an expired JWT but no reference to the original Google response (initially received from via onSuccess callback when we logged in prior to closing the browser). Without it we cannot call res.reloadAuthResponse() to retrieve a new token.

Is my analysis correct, or am I missing something in my understanding? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions