next-auth icon indicating copy to clipboard operation
next-auth copied to clipboard

There is no exhaustive guide for setting up auth.

Open pankajkumar48 opened this issue 1 year ago • 4 comments

What is the improvement or update you wish to see?

I would like to see a guide starting from scratch to set it up and get it working

Is there any context that might help us understand?

There are scattered docs available for everything but no one page read and implement type guide

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

No response

pankajkumar48 avatar Feb 17 '24 05:02 pankajkumar48

For me was really helpful this video tutorial: https://youtu.be/1MTyCvS05V4 Guy goes through from social login to email auth - I think it will give a good understanding of core functionalities.

(Just trying to help)

m-muiznieks avatar Feb 17 '24 17:02 m-muiznieks

I agree it's very confusing. It says one thing on auth.js docs and then another things on the github, and then something else different somewhere else. The video is super helpful. Funny enough I found it today too but I am getting an error for missing module for next/server and completely lost what to do.

bwheeele avatar Feb 17 '24 18:02 bwheeele

Yes, I know what you're talking about, @bwheeele

Currently I am sitting on 5.0.0-beta.4 version. I found out that slightly changing the module imports solves this issue.

For example: import NextAuth from "node_modules/next-auth";

I am not a specialist, but a total novice but I understood, that the issue somehow is related to next-auth.d.ts file (?). As it in one moment just started everything to point to that exact file instead of module.

But I am reserving the rights to be totally wrong about that - the only thing is important, that quick fix is possible with adding node_modules before the next-auth related paths.

m-muiznieks avatar Feb 17 '24 19:02 m-muiznieks

@m-muiznieks Is yours like this too? ⨯ Error [ERR_MODULE_NOT_FOUND]: Cannot find module '//node_modules/next/server' imported from //node_modules/next-auth/lib/env.js Did you mean to import "next/server.js"?

Any time I hit api/auth anything I get this error.

bwheeele avatar Feb 17 '24 19:02 bwheeele

I also got this error, Cannot find module 'node_modules/next/server' imported from node_modules/next-auth/lib/env.js . "next": "14.1.0", "next-auth": "^5.0.0-beta.13",

zhaozhonglei avatar Feb 22 '24 21:02 zhaozhonglei

@m-muiznieks Is yours like this too? ⨯ Error [ERR_MODULE_NOT_FOUND]: Cannot find module '//node_modules/next/server' imported from //node_modules/next-auth/lib/env.js Did you mean to import "next/server.js"?

Any time I hit api/auth anything I get this error.

i got the same error on [email protected] and [email protected], running [email protected]

i was able to get it going setting esmExternals to false but that seems not ideal. i'm guessing it has something to do with my project configuration

tedkalaw avatar Mar 06 '24 00:03 tedkalaw

I was able to fix it by adding .js to end of all the files with server/navigation. I don't understand why I have to do this though and this is not a proper fix. I have auth.js and next same versions in a separate app and don't have this issue. The other was created from scratch and the one I am getting the error on was added into existing code. Really disappointing to not here any feedback yet as to what the issue is or how to fix it.

bwheeele avatar Mar 06 '24 13:03 bwheeele

Hey sorry for the confusion folks, we've released a whole new docs website which includes some nice walkthroughs for all the authentication types.

For example for OAuth: https://authjs.dev/getting-started/authentication/oauth

Also there's a mroe detailed guide which uses GitHub as an example to setup an OAuth provider: https://authjs.dev/guides/configuring-github

I'm going to close this issue, but feel free to open a new one if you still have a specific issue :pray:

ndom91 avatar Apr 12 '24 12:04 ndom91