-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
fetchAuthSession throws TooManyRequestsException #13565
Comments
Hi @didemkkaslan Thanks for opening this issue. By looking at your sample code, you are implementing a In addition, the Can you try to remove the useage of |
Hello @HuiSF sorry for the late reply. I had to use I had to include below code to make it work
|
I'm a bit confused about if it is required to refetch scopes for token refresh events or should I only refetch the scopes when signIn or signInWithRedirect occurs |
I've realised I haven't share the code I get the TooManyRequestsException error. So the problem is tokenRefresh event is fired many times so fetchAuthSession is called many times and we have the error
|
@didemkkaslan I had to de-deuplicate fetchAuthSession so only a single instance of it can fire at once. See #13499. |
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
REST API
Amplify Version
v6
Amplify Categories
api
Backend
CDK
Environment information
Describe the bug
Hello, I'm using
fetchAuthSession
to get idtoken and use it as Authorization header. And also I use it to get user scopes I started to get TooManyRequestsException is there anything I should shouldn't do? Not sure how to approach this problem. Thanks in advanceExpected behavior
No rate limit errors
Reproduction steps
Use fetchAuthSession multiple places in the app
Code Snippet
// Put your code below this line.
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: