-
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
Storage ExpiredToken: The provided token has expired #12787
Comments
Hi @kolodi thank you for opening this issue. I see that you are using an Next JS app, does this issue seem to be specific to Server Side pages? Or do you see it regardless of client side/server side usage? Also I'm working through testing this myself but curious if you have had a chance to see this happen on a SPA app. |
Hi @nadetastic, You are tight. I have older "vanilla" js/ts (webpack) SPA application. It is using the Storage in the same way as this new Next app, infact, it is using the same Amplify backend (it was a single module of the project that I am almost dome migrating under the common next js application). And the browser upload to S3 it is working fine there, even after 1 hour after login. Btw, I have ssr=true in my Amplify config. import config from '../src/aws-exports';
Amplify.configure({
...config,
ssr: true,
}); |
So it must be related to SSR in next.js. Any expert in this area can take a look? |
@kolodi it looks like you are using an older major version of |
Thx for reply @nadetastic . |
I’m facing the same problem as well. |
I ended up migrating to v6 and not using ssr |
I upgraded to v6 today, but I'm still getting an "ExpiredToken" error after exactly one hour when uploading files. I'm not using ssr as well. My investigation suggests that the temporary security credentials used for uploading aren't being refreshed. These credentials expire after one hour. The code seems to check the token's expiration before each upload part, but incorrectly logs that it's still valid even when it's not. Some Logs:
Then it stops completely. |
It's suggested at Expired Token: The Token is Expired - Managing Tokens Properly #12734 |
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
Authentication, Storage
Amplify Categories
auth, storage
Environment information
Describe the bug
Storage operations fail due to token expiration. Amplify should take care of refreshing tokens automatically but it is not working for Storage for some reason. I still can do other operations like calling GraphQL and REST APIs, but the Storage is working only when refreshing completely the page.
Expected behavior
Storage.put ot Storage.get should be using refreshed tokens as other services do.
Reproduction steps
Code Snippet
Log output
aws-exports.js
Manual configuration
No response
Additional configuration
Additional Storage configurations
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: