Skip to content
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

fetch multiple access tokens simultaneously #381

Open
4 tasks done
githorse opened this issue Jan 10, 2025 · 0 comments
Open
4 tasks done

fetch multiple access tokens simultaneously #381

githorse opened this issue Jan 10, 2025 · 0 comments

Comments

@githorse
Copy link

githorse commented Jan 10, 2025

Checklist

  • I have looked into the Readme and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Describe the problem you'd like to have solved

My SPA uses many different access tokens. Because fetching these tokens can take several seconds, I wrote code to pre-load them all at app startup, rather than waiting until the user clicks on a specific widget to load the token for that particular API. Since getAccessTokenSilently() returns a promise, I thought I was fetching these tokens in parallel. I can verify that the calls to getAccessTokenSilently() all occur synchronously, within a few milliseconds (in other words, they're behaving as I expect). But a closer inspection of the Network tab reveals that the actual requests to {my-app}.auth0.com/oauth/token are queued up and executed one at a time. I'm not sure where or why this queueing is happening.

Describe the ideal solution

Ideally, these requests would just happen in parallel (up to some reasonable number of connections, perhaps).

Alternatives and current workarounds

An alternative might be a getAccessTokensSliently() method that handles batch requests.

Additional context

No response

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

No branches or pull requests

1 participant