-
Notifications
You must be signed in to change notification settings - Fork 364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent getTokenSilently
to be called concurrently
#125
Conversation
const IFRAME_ID = 'a0-spajs-iframe'; | ||
if (document.getElementById(IFRAME_ID)) { | ||
throw new InternalError( | ||
"`getTokenSilently` can only be called once at a time. Check your code to make sure you're not calling it multiple times." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when in this function's code are you calling twice getTokenSilently
? if the answer is "nowhere" I think this error should be different. Even the tests mention "throws an error when the iframe already exists". Then why is this error talking about the specific use case of calling getTokenSilently
multiple times? That's out of this method's scope IMO. Maybe the caller should be checking that and re-throwing a similar error up.
00648b4
to
5a03f7f
Compare
Hey @luisrudge, what still needs to be done here? |
@nojaf we're having internal conversations about this. I'll ping this thread once we release this |
After reevaluating this issue and our goals, it became clear that we need to support multiple calls of this method in parallel (even though the requests won't be able to run in parallel). We'll discuss another approach to internally serialize those requests. Thanks for the patience. |
Any progress on this? |
@luisrudge Any update on this? |
@ipzKellyR @iamchathu This feature was released in v1.4.0, see also #238
|
@stevehobbsdev Thanks! But in your release notes, it isn't clear what super-tokens are. And the link you put does not work: https://github.com/super-tokens |
fix #109
Description
Today, if you call
getTokenSilently
in parallel, there's no guarantee that the message we receive from the iframe will be received by the correct iframe handler, which causes issues like #109. To fix this behavior and prepare our SDK for rotation of Refresh Token, we need to explicitly allow only a single call at a time.Testing