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
Need some clarity on how to use the library with server and client components #10720
Comments
Mentioning the examples would be helpful as well: https://github.com/nextauthjs/next-auth-example |
Yeah good call. We really wanted to recommend server component usage, although its still possible to use the existing The idea is to grab the session, trigger signin/signout, server side. And then pass any info, like the session, down to client components via props, for example. But we can definitely make that more clear, while also showing a good example for client-side usage. |
In addition, the example app has a client-component example as well. See |
As Nico mentions, nothing has changed in how you use NextAuth.js in Client components/Pages Router compared to v4. |
What is the improvement or update you wish to see?
Looking into this page: https://authjs.dev/getting-started/session-management/get-session. The app router has an explanation only for the server component without mentioning how to use client components.
It would be great if the client component is explained here and mentioned that the auth() function can only be used for the server (it's written somewhere in previous issues).
Is there any context that might help us understand?
This would be helpful for those who wants to use authjs immediately without going through v4, in migration guide it's explained on how to use both server and client components but it's not mentioned in the main docs. Which would be helpful to get that.
Does the docs page already exist? Please link to it.
No response
The text was updated successfully, but these errors were encountered: