-
Notifications
You must be signed in to change notification settings - Fork 1.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
bug: not logged in when rendering SSR #715
Labels
Comments
chamatt
changed the title
bug: not logged in when SSR
bug: not logged in when rendering SSR
Nov 10, 2022
Get the session on server via gSSP and pass it down as props |
Explained here: https://next-auth.js.org/getting-started/client#sessionprovider |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Provide environment information
System:
OS: macOS 13.0
CPU: (8) arm64 Apple M1
Memory: 386.59 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.15.1 - ~/.nvm/versions/node/v16.15.1/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v16.15.1/bin/yarn
npm: 8.11.0 - ~/.nvm/versions/node/v16.15.1/bin/npm
Describe the bug
Given a logged-in user, when the page renders server side, the user is not logged in yet, so the page shows the sign-in button. Only when it loads the client side that it fetches the login info and displays it.
Is this the expected behavior? Is there a way to have the session passed in during SSR so that useSession doesn't return null during the ssr render pass?
I saw this PR in the repo where it contained a snippet to passthrough the headers in tRPC (#396), but it's not in the repo anymore (why was it removed?), and that is also not enough.
To reproduce
Additional information
The text was updated successfully, but these errors were encountered: