nextauthjs / next-auth

Authentication for the Web.
https://authjs.dev
ISC License
22.88k stars 3.08k forks source link

Migration to v5 guide - missing getSession #10941

Closed mmarrius closed 3 weeks ago

mmarrius commented 4 weeks ago

What is the improvement or update you wish to see?

Use auth() instead of getServerSession, getSession, withAuth, getToken, and useSession is found here but then getSession is nowhere else on the page described. Should auth() be used instead of it? If yes, why isn't it included in the list of examples?

Is there any context that might help us understand?

getSession is the bread and butter in v4 but is sparsely mentioned in v5. Should it still be used?

Does the docs page already exist? Please link to it.

https://authjs.dev/getting-started/migrating-to-v5

ndom91 commented 3 weeks ago

Hey yeah so there's a hard split between where you should use auth() and where you shuold use getSession/useSession.

We recommend grabbing your session in the nearest server-component and passing it down via props to a client-component though, instead of using those client methods, if possible.

ndom91 commented 3 weeks ago

If theres any specific improvements you'd like to see, feel free to open a PR and we can talk about it more there :pray:

Otherwise, i'll close this issue for now