-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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: introduce experimental unstable_getServerSession
API
#4116
feat: introduce experimental unstable_getServerSession
API
#4116
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/nextauthjs/next-auth/4Sn474Kx6ArjZ923F4sxXM1Me7j4 |
docs/docs/configuration/nextjs.md
Outdated
const session = await getServerSession(req, res, authOptions) | ||
|
||
if (session) { | ||
// do something with the session |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we rather have a different response when there is or there isn't a session? Eg. return 401 if un authenticated
docs/docs/configuration/nextjs.md
Outdated
if (session) { | ||
// do something with the session | ||
} | ||
|
||
return { | ||
props: { | ||
session, | ||
}, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we return a redirect if unauthenticated? https://nextjs.org/docs/api-reference/data-fetching/get-server-side-props#redirect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally!
getServerSession
APIgetServerSession
API
79dc7ff
to
72e4da4
Compare
14f335e
to
86d763c
Compare
86d763c
to
7870118
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good for me ✅ ; I leave some small grammar suggestions 👍🏽
getServerSession
APIunstable_getServerSession
API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's land this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Occurrences of getServerSession
need to be replaced with unstable_getServerSession
.
Co-authored-by: Dragate <[email protected]>
@balazsorban44 please merge it when you're back! 🙌 |
It will require 24hrs for Algolia to scrape the latest docs page deployment and update the search index. |
The docs mention that this is an experimental feature, but nowhere to be found is why this is unstable. This makes it difficult for me as a user to figure out if I even should consider it before it becomes stable and look for alternatives. Anyone mind to explain the "unstable" situation here? |
I'm not super keen about how an API was removed (renamed) without a semver bump. |
@larsqa Theres a small note in the docs:
The API was released with the
@DavidJFelix |
I think the issue really is a breaking change to |
Reasoning 💡
Improve thegetServerSession
API to match theNextAuth
API.getServerSession
tounstable_getServerSession
Checklist 🧢
Affected issues 🎟