Closed cekpowell closed 4 months ago
Hello, @cekpowell 👋. This looks related to issue #13472, which has had a fix released recently to resume the token refresh on the server side when necessary. Can you see if upgrading your @aws-amplify/adapter-nextjs
to version 1.2.4 resolves the issue?
Closing this issue as we have not heard back from you. If you are still experiencing this, please feel free to reply back and provide any information previously requested and we'd be happy to re-open the issue.
Thank you!
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
Authentication
Amplify Version
v6
Amplify Categories
auth
Backend
Other
Environment information
Describe the bug
Context
runWithAmplifyServerContext
API.Bug
fetchAuthSession
is only able to fetch the session if the auth tokens (id and access) have not yet expired. Once the tokens have expired, thefetchAuthSession
does not refresh the session using the refresh token, and just sets the session properties to undefined./sign-in
even though the do have a valid auth session - they just need to have their tokens refreshed.fetchAuthSession
will refresh the tokens and return the updated ones to the client, but this is not the case.MVP
/sign-in
page as the middleware code will determine you to be signed out.Expected behavior
The
fetchAuthSession
being run on the sever should refresh the user's tokens if they have expired, and return the updated tokens in the response object.Reproduction steps
The docs i linked earlier give a simple MVP for this issue. If you set a short (e.g., 5 min) expiry time on your access tokens, sign in, wait for the token to expire, and refresh, you will be taken to the
/sign-in
page as the middleware code will determine you to be signed out.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