Uploaded image for project: 'Realm JavaScript SDK'
  1. Realm JavaScript SDK
  2. RJS-1323

Realm Web: Refresh access tokens ahead of time

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None

      Problem

      Users are experiencing messages in the browsers console as a request fails due to an expired access token.
      Even though these errors doesn't inflict any functional pain on developers or their users, we they're a slight inconvenience and we should eventually find a way to get rid of them.

      Solution

      Two solutions comes to mind:

      1. Check the expiration of the access token and compare it to the browsers time and ensure to preflight a request to refresh it if it's expired.
      2. Refresh the access token on a timeout, to ensure it is refreshed ahead of time, before a request is made.

      I would suggest we go for option 1, since 2 is not guaranteed to actually refresh before a request (ex. the computer was hibernating as the timeout should fire). Also option 2 would probably cause warnings in React Native (as scheduling a timeout in the far future does).

      How important is this improvement for you?

      Fairly niche, but nice to have anyway.

            Assignee:
            Unassigned Unassigned
            Reporter:
            kraen.hansen@mongodb.com Kræn Hansen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: