Closed dushajni closed 3 months ago
Hi @dushajni thanks for opening this issue. By looking at the code sample you provided, there may be a code error, that the {ssr: true}
should be passed as the second parameter while calling Amplify.configure()
on the client-side of your Next.js app (this is a required step in order to send auth token cookies to your Next.js server). Could you double check following the Amplify JS Next.js documentation?
Hi @HuiSF . Thnx for the reply, and yeah, it solved my problem! :) Thnx a lot!
Glad to help @dushajni! Please let us know if anything else that we can assist on this thread
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
Authentication
Amplify Version
v6
Amplify Categories
auth
Backend
None
Environment information
Describe the bug
Hi. I'm using nextjs with aws amplify and existing endpoints. I copied configuration from official documentation, but I have a problem with using fetchAuthSession(contextSpec) in middleware.js because it returns object with undefined values:
{ tokens: undefined, credentials: undefined, identityId: undefined, userSub: undefined }
when I use fetchAuthSession() in client side components it returns normal values.
Expected behavior
to return object with values:
{ tokens: xxxx, credentials: xxxx, identityId: xxxx, userSub: xxxx }
Reproduction steps
I'm using latest Nextjs, with latest aws amplify, copied code from official documentation but I can't get it work.
Code Snippet
amplify config:
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