Closed didemkkaslan closed 5 months ago
I also noticed this behaviour upgrading from "@aws-amplify/adapter-nextjs": "^1.0.21"
and "aws-amplify": "^6.0.20"
to the latest version. i think the fetchAuthSession, fetchUserAttributes, getCurrentUser
fails to fetch latest values when accessToken is expired.
Hello @mehrdad-shokri thanks for the comment. Do you think using the exact
@aws-amplify/adapter-nextjs: "^1.0.21"
aws-amplify: "^6.0.20"
versions would solve the problem
I'm not sure. it wasn't happening for me on 6.0.20
now have downgraded to it but still happening.
I got some more context: So the app waits in the background like 15min or so and I saw ERR_CONNECTION_CLOSED on the console and then UserUnAuthenticatedException error. Finally scopes became empty
hello everyone. This issue is solved on the latest version of the library. Can you please upgrade and let us know if you are still having issues ?
Hello, sure I've updated the versions to latests. I'll update here if the issue persists thank you
Apologies there was a confusion, the change is not yet out. We have a fix PR that is on its way. I'll update the ticket when the change is released to npm.
Hi @didemkkaslan we've released the fix to resume the token refresh on the server side when it's necessary.
Please upgrade @aws-amplify/adapter-nextjs
to version 1.2.4
.
Linking this to the related #13456 as well.
It's fixed now. thank you <3
Hello, thanks everyone its fixed. ❤️
@mehrdad-shokri and @didemkkaslan, thank you for the confirmations! We'll close this issue out as resolved then.
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
Authentication
Amplify Version
v6
Amplify Categories
auth
Backend
CDK
Environment information
Describe the bug
We are using
session?.tokens?.idToken?.payload?.scope?.split(' ') ?? [],
for feature toggling. I'm calling getScopes on pages getServerSideProps to enable/disable some app features. But sometimes scopes returns undefined. So the feature toggling is broken. I really don't know why it happens, maybe refresh token related?Expected behavior
idToken.payload shouldnt be undefined
Reproduction steps
Use fetchAuthSession serverside to get the session inside pages getServerSideProps. Sometimes its just undefined
Code Snippet
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