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
1 answer

User credentials are null when using getSession() in middleware, next-auth

I'm trying to access the user credentials from the JWT & Session using callbacks import NextAuth from "next-auth/next"; import CredentialsProvider from "next-auth/providers/credentials"; import User from "../../../models/user"; import dbConnect from…
0
votes
0 answers

Next-Auth: Cannot get Access Token with getToken() inside API middleware inside getServerSideProps() [ Undefined Error ]

my access_token from const access_token = await getToken({ req, secret }) always returns undefined inside the next-js API Middleware which is called by await axios.get() inside getServerSideProps(), is this normal? I can get the accessToken inside…
yeln
  • 462
  • 2
  • 10
  • 23
0
votes
0 answers

Multitenancy in NextJS

I am trying to create a project with Multi-tenancy where we will be deploying to multiple sites say, a.example.com b.example.com Using Keycloak as a provider. Initally went with NextAuth considering it was easy to setup and it seemed to work fine…
Mahesh
  • 513
  • 3
  • 12
0
votes
0 answers

NextAuth not storing user data to MongoDB

User data isn't saving to mongo, I did this a while ago but I can't seem to get it to work now. I'm using "mongodb": "^3.5.9" so it's not a version error and I can also connect to the database outside of NextAuth, so it's not a connection issue from…
0
votes
1 answer

How can I submit to custom credentials?

Hello I have the following next auth configuration: import NextAuth from "next-auth" import CredentialsProvider from "next-auth/providers/credentials" export default NextAuth({ providers: [ CredentialsProvider({ name:'Login', …
Tlaloc-ES
  • 4,825
  • 7
  • 38
  • 84
0
votes
0 answers

#NextJS, #React Needing to define two different type of login forms

I have two type of login forms: Common users Corporates I wanted using @next/auth but I cannot change the default path of the login workflow api/auth/ to api/corp/auth or api/user/auth. I created [...nextauth].ts file and its workflow works fine…
Lollo
  • 535
  • 2
  • 5
  • 18
0
votes
1 answer

next-auth error between Prisma Adapter and Keycloak (error_linkaccount, not-before-policy)

I use next-auth and I have a prisma adapter to PostgreSQL. When I connected to keycloak(openid), it occoured errors. prisma, postgresql, keycloak, nextauth my all error logs below: [next-auth][error][adapter_error_linkAccount]…
밍원MinGWon
  • 435
  • 1
  • 4
  • 6
0
votes
0 answers

How do I get NextAuth's MongoDB Adaptor to use a specific database name when using database?

I'm following this short guide on how to use the MongoDB Adaptor with NextAuth.js. It sort of works. After I install it like so: import clientPromise from "../../../lib/mongodb" export const authOptions: NextAuthOptions = { adapter:…
a53-416
  • 3,585
  • 6
  • 34
  • 44
0
votes
0 answers

Middleware redirect to log in doesn't work

I'm building a Spotify clon, and i`m trying to use middleware to check if there's a token, if there's a token the you're logged in and you can use the clon. If are not logged in or if you log out middleware should redirect you to the log in page.…
Iván
  • 41
  • 10
0
votes
0 answers

Next Auth + Firebase - Change user password using firebase Rest API

I am working on project using Next JS + NextAuth package. For user authentication we are using NextAuth with Custom Credentials provider. I am making a sign in REst API request to Firebase to get the user logged in and saving all necessary bits like…
0
votes
0 answers

Next-auth JWT user missing values after logging in

I ran into some issues regarding the JWT user being null after a succesfull login. Did some debugging in the callbacks and saw the following: 2 { token: { token: { name: null, email: null, picture: null, sub:…
Noob
  • 5
  • 3
0
votes
0 answers

What is the difference between SECRET and NEXTAUTH_SECRET environment variables in NextAuthJS?

what is the difference between those two environment variables in the .env.local.example example file from NextAuth? I found in the documentation that if you want to use JWT on auth requests, you need to provide a hash value on NEXTAUTH_SECRET but I…
Gabriel TN
  • 694
  • 1
  • 5
  • 9
0
votes
0 answers

From Azure AD Token to Microsoft Graph Token in Next-Auth (react)

Hi Stackoverflow community, this is my first question here after not finding a solution to my problem. To begin with, we are having an app registration on azure to our Azure Active Directory and configured our react-next-js project to authenticate…
0
votes
1 answer

NextAuthJS - Custom user model

i am using CredentialsProvider to auth users into my app. But in authorize function, even if i give the user variables coming from my API Endpoint: NextAuthJS only catches e-mail variable. Is there a way to pass all variables inside session? async…
schwarzsky
  • 80
  • 7
0
votes
1 answer

Updating/mutating a session with next-auth and tRPC

I am building a multi-tenant NextJS app that uses next-auth for account authentication, tRPC for API's, and postgresql for a data store. I am trying to find a way to dynamically update/set/mutate a session value based on some client-side…
tdc
  • 5,174
  • 12
  • 53
  • 102