Questions tagged [next-auth]

NextAuth.js is a open source authentication solution for Next.js applications. This tag is rarely used alone and is most often used in conjunction with [next.js]

1602 questions
0
votes
2 answers

How to solve client fetch error for next-auth authentication

I have created an app that connects to a mongodb cluster and stores user info. The user is then able to log in with Next-Auth functionality. The app was working just fine before deploying to Vercel. On the live site I ran into some Server Config…
Felipe
  • 333
  • 7
  • 19
0
votes
1 answer

NextAuth and TypeOrm - Retrieve a repository in an api endpoint

I've got an NextJS app with NextAuth and TypeORM. I'm looking for the possibility to retrieve a specific user or custom entity in an api endpoint. However, i don't know how to do this properly. I don't want to re-initialize the connection options on…
0
votes
1 answer

NextAuth: authorize all APP with Layout wrapping

I'm trying to use NextAuth for authorize access to my app and I have two main issue. 1 - all the app is wrapped with a Layout in _app.js
b81
  • 69
  • 1
  • 10
0
votes
1 answer

Next-auth CredentialProvider config and redirect

I'm a bit confused on the implementation of the credentials provider and the redirects. The documentation says that the credentials provider doesn't support a callback and its for the OAuth providers. This is fine. However, instead of staying on the…
Deeswoc
  • 159
  • 1
  • 13
0
votes
1 answer

Storing Additional Information via Next-Auth's JWT Callback or Session callback? (Saving Patreon Tier in Next-Auth)

I am trying to use next-auth with the patreon api. Logging in & out works fine, but I now want to also save the users tier somewhere - the question is where? I was thinking of putting it directly on the jwt via the jwt callback, or maybe in the…
antonwilhelm
  • 5,768
  • 4
  • 19
  • 45
0
votes
1 answer

Google provider in Next-Auth does not work in conjunction with Azure SQL

I can login with Github for example, but when I am using Google account, it throws an error below. I tried different adapters, but could not find the right, if Sequelize is not compatible? I can see there is a truncated value, but I am unsure how to…
0
votes
1 answer

SSL Certificate is unable to be verified when sending request to the same machine

I have a remote Ubuntu machine running a node server with next.js and using next-auth for authentication. Everything works fine with HTTP locally. Configuration Here is the code that runs the node server on HTTPS and uses next.js. const https =…
Goel
  • 53
  • 2
  • 9
0
votes
1 answer

Next-auth (JWT) logging sessions

According to Next-auth documentation as we are using credentials provider to connect to our users collection for usernames and passwords Next-Auth does not use the session database to check if a session is active. If you use a custom credentials…
0
votes
1 answer

next-auth 4 session returns null, next.js

This is code in api/auth/[...nextAuth].js import NextAuth from "next-auth"; import CredentialsProvider from "next-auth/providers/credentials"; import User from "@/models/user"; import connectToDb from "@/config/dbConnection"; export default…
Yilmaz
  • 35,338
  • 10
  • 157
  • 202
0
votes
1 answer

Next-auth middleware 'eval' not allowed

I'm trying to implement a simple next-auth middleware to protect all api routes except a /api/healthcheck route. I wrote the following within /pages/api/_middleware import { withAuth } from 'next-auth/middleware'; // protect all api routes but…
0
votes
1 answer

Typescript Generic Syntax < P extends U | undefined = undefined >

I bumped to this definition when I was browsing Next-auth.js type definition. export declare function signIn

(provider?: LiteralUnion, options?: SignInOptions,…

ANTARES_SEO
  • 317
  • 4
  • 9
0
votes
1 answer

Loading a next-auth protected page shows the wrong message while and before loading

Consider a sinple next.js page like this const Index: NextPage = () => { const {data: session} = useSession(); const [data, setData] = useState(null); const [isLoading, setLoading] = useState(false); useEffect(() => { …
user3174311
  • 1,714
  • 5
  • 28
  • 66
0
votes
0 answers

Next-Auth JWT Session Token

Currently I am returning the users email to the session as a JWT. This is working just fine. Now I am trying to return the users username with the email as a JWT. If I am to console.log the username, it is appearing in the terminal. Yet, if I am…
Felipe
  • 333
  • 7
  • 19
0
votes
0 answers

NextJs website + Cognito auth + next-auth npm package + S3 -> Getting CLIENT_FETCH_ERROR

I build my front-end using NextJs and am hosting the website on AWS S3. Everything was fine until I tried to add cognito authentication. I found this npm package that was supposed to make everything easy: next-auth. However I keep getting…
0
votes
1 answer

How to use next-auth using ldap and prisma

i am using next-auth with ldap to authenticate user name and password. i am able to log/authenticate the user using username and password. but when i can't create user using prisma as await is not allowed inside promise. this is my…