nextauthjs / next-auth

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

publish feat/nextjs-auth #7980

Closed zwhitchcox closed 1 year ago

zwhitchcox commented 1 year ago

Description 📓

Regarding #7953, it looks like the feat/nextjs-auth branch is necessary to use the App Router, which is the default recommendation of NextJS.

It might be helpful for that branch should be published so we can use the recommended feature, or could you provide some clarity on how we should use this repo in coordination with NextJS? Unless you guys are not coordinating the repos together?

How to reproduce ☕️

Following the examples at

https://github.com/nextauthjs/next-auth/tree/790f7617083d055b94d05c5c815749258da84852/apps/examples/nextjs

and https://github.com/nextauthjs/next-auth/tree/790f7617083d055b94d05c5c815749258da84852/apps/dev/nextjs

I get the errors:

- error app/page.tsx (7:28) @ auth
- error TypeError: (0 , _auth__WEBPACK_IMPORTED_MODULE_1__.auth) is not
 a function
    at Home (./app/page.tsx:19:70)
    at async Promise.all (index 0)
   5 | 
   6 | export default async function Home() {
>  7 |   const session = await auth();
     |                            ^
   8 |   return (
   9 |     <>
  10 |       <Head>

and

  31 | 
  32 | export const {
> 33 |   handlers: { GET, POST },
     |              ^
  34 |   auth,
  35 |   CSRF_experimental,
  36 | } = NextAuth(authOptions)

Contributing 🙌🏽

Yes, I am willing to help implement this feature in a PR

zwhitchcox commented 1 year ago

Ok, this was hard to find, but there's a guide on upgrading to V5 that I guess we're supposed to use?

And looking at the npm repo, there's a version 0.0.0-manual.83c4ebd1, which I guess is the build from feat/nextjs-auth branch that I guess we're supposed to use as well?

It was quite hard to find both of these, so that's why I'm not sure...still better than building from source.

zwhitchcox commented 1 year ago

Ok, this is the only working example of next-auth v5 I've found that's fully functional, that I intend to copy.

It's using all the things I've mentioned, plus next.js canary. I think it's a good project to emulate:

https://vercel.com/templates/next.js/nextjs-ai-chatbot

zwhitchcox commented 1 year ago

cc @Yedidya10

balazsorban44 commented 1 year ago

7443 has all the information for those who want to try it out. It's not ready for the general public yet, we are currently dogfooding it in some projects. Please keep feedback on the PR, thanks.

barqco commented 1 year ago

Ok, this is the only working example of next-auth v5 I've found that's fully functional, that I intend to copy.

It's using all the things I've mentioned, plus next.js canary. I think it's a good project to emulate:

https://vercel.com/templates/next.js/nextjs-ai-chatbot

Still looking for an example with Suspense and Next-auth v5 haha.