You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
avi312singh opened this issue
May 13, 2024
· 0 comments
Labels
adaptersChanges related to the core code concerning database adaptersbugSomething isn't workingtriageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
This code succesfully generates session in our dynamoDb table which we have specified using a custom name when a user authenticates with either of our two providers, as seen in screenshot below:
The screenshot shows the newly created session within dynamoDb after the user attempts to authenticate next-auth routes them back to the signin page, as the session cannot be retrieved.
However when attempting to retrieve the session before landing on the authenticated protected page, the useSession() hook retrieves null for the session.
Loading status:
Resolved status:
The authentication was fully working before this relatively small PR, ignore the fact that no credentials are provided as we are using roles within IAM so that the frontend has access to the table within dynamoDb. As sessions are being succesfully created in the table specified, the roles have been setup correctly.
How to reproduce
Migrate from JWT to database strategy
Use client side useSession() hook to retrieve session and check if user is authenticated before rendering protected page
Authentication will break and next-auth will redirect to sign in page
Expected behavior
Migrate from JWT to database strategy
Use client side useSession() hook to retrieve session and check if user is authenticated before rendering protected page
Authentication will continue to work after migration from JWT and next-auth will redirect to a protected page
The text was updated successfully, but these errors were encountered:
avi312singh
added
adapters
Changes related to the core code concerning database adapters
bug
Something isn't working
triage
Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
labels
May 13, 2024
adaptersChanges related to the core code concerning database adaptersbugSomething isn't workingtriageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Adapter type
@auth/dynamodb-adapter
Environment
Reproduction URL
https://github.com/NHSDigital/Galleri-Frontend/blob/spike/next-authv4/src/app/api/auth/%5B...nextauth%5D/route.ts
Describe the issue
This code succesfully generates session in our dynamoDb table which we have specified using a custom name when a user authenticates with either of our two providers, as seen in screenshot below:
The screenshot shows the newly created session within dynamoDb after the user attempts to authenticate next-auth routes them back to the signin page, as the session cannot be retrieved.
However when attempting to retrieve the session before landing on the authenticated protected page, the
useSession()
hook retrievesnull
for the session.Loading status:
Resolved status:
The authentication was fully working before this relatively small PR, ignore the fact that no credentials are provided as we are using roles within IAM so that the frontend has access to the table within dynamoDb. As sessions are being succesfully created in the table specified, the roles have been setup correctly.
How to reproduce
JWT
todatabase
strategyuseSession()
hook to retrieve session and check if user is authenticated before rendering protected pageExpected behavior
JWT
todatabase
strategyuseSession()
hook to retrieve session and check if user is authenticated before rendering protected pageJWT
and next-auth will redirect to a protected pageThe text was updated successfully, but these errors were encountered: