smogg / auth-mutli-tab-issue

1 stars 1 forks source link

Update app.js #1

Closed adamjmcgrath closed 1 year ago

adamjmcgrath commented 3 years ago

As a temporary measure, have a look at limiting the number of concurrent getTokenSilently requests per tab. This should significantly reduce the chance of FERRT errors, the user would need to have a lot of tabs open (probably >10) to hit the issue.

You could use something like https://github.com/sindresorhus/p-limit to do this in a nicer way

smogg commented 3 years ago

@adamjmcgrath thanks. We already have a similar solution in place actually. The approach we took right now is to only ever allow the in-focus tab to perform a token refresh, which seems to work reliably (however should probably not be a long-term solution).

However we still are having problems quite frequently, so I think I might have pointed at the wrong thing by mentioning multiple tabs. Please take a look at the single-tab branch of this repo: https://github.com/smogg/auth-mutli-tab-issue/tree/single-tab