IAM Graphql call always returns expired Session Credentials after 1 hr #13223
Labels
GraphQL
Related to GraphQL API issues
pending-response
Issue is pending response from the issue requestor
to-be-reproduced
Used in order for Amplify to reproduce said issue
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
Authentication, GraphQL API
Amplify Version
v6
Amplify Categories
auth, api
Backend
None
Environment information
Describe the bug
On Dev, after bumping the version to 4.0.27, it seems like all my unauthorized calls are returning "ExpiredTokenException"
I checked the fetchAuthSession call, and even when calling with
forceRefresh
, the token did not update, and the Expiration at(await fetchAuthSession({ forceRefresh: true })).credentials.Expiration
was always in the past. The only way to fix this seems to be torm -rf .next
and restart the server, which caused the new session credentials to get created. However, this will likely lead to a problem in production if tokens expire after that long and never get refreshed. We are using identity pool access and it has been working on our live site (as of 4 days ago, on 4.0.21).Expected behavior
I expect session tokens get refreshed automatically. We chose IAM instead of API KEY as the unauth authorization mode since we would not have to worry about expiries.
Reproduction steps
Turn on
ConsoleLogger.LOG_LEVEL = "INFO"
, and see that the logis printed beforehand, and we see the call for
ExpiredTokenException
right afterwards.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: