Skip to content
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

feat: update auth documentation for app router #1894

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update next-auth.mdx
  • Loading branch information
juliusmarminge committed May 26, 2024
commit 93fd7ebccc4f27d0fea6f138daf6a58ad3353b44
2 changes: 1 addition & 1 deletion www/src/pages/en/usage/next-auth.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const User = () => {

## Retrieving session server-side
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this should be split to 2 sections (pages and app)

the old pages setup is still relevant afaik?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure i understand? The pages setup is still very relevant but i thought a warning might be a good call. In theory, the server-side retrieval section serves as the "other section" that explains how auth works in app router situations.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you removed the gSSP part of the docs explaining how to retrieve session on the server in pages router.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand what you mean now.


If you have configured your application to use Next's `/app` router, the reccomended behavior is to request the session on the server rather than the client. This is how `create-t3-app` is configured by default.
If you have configured your application to use Next's `/app` router, the recomended behavior is to request the session on the server rather than the client. This is how `create-t3-app` is configured by default.

In your app's entrypoint you will notice that the auth session has been prefetched using the `getServerAuthSession` helper function that `create-t3-app` provides.

Expand Down