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
27
votes
2 answers

Where and how to change session user object after signing in?

I have weird problem and I don't know where the problem is. I use next-auth library to make authentication system in my Next.js app. Everything is OK - I can sign in by checking if there is account in google firebase with submitted credentials,…
MateuszWawrzynski
  • 1,231
  • 2
  • 7
  • 15
25
votes
3 answers

Next-Auth : How the registration is handled with a email + password credential provider?

How the registration is handled with a custom credential provider ( email + password)? Currently my [...nextauth].js looks like this: import NextAuth from 'next-auth' import Providers from 'next-auth/providers' import axios from 'axios' import jwt…
yeln
  • 462
  • 2
  • 10
  • 23
22
votes
5 answers

(NextAuth) Type error: Property 'session' does not exist on type '{}'

I'm using NextAuth on a NextJs project and I'm getting the error "Type error: Property 'session' does not exist on type '{}'.". I'm adding the session property to my _app.tsx as suggested here: https://next-auth.js.org/getting-started/example I've…
Alexandre Paiva
  • 987
  • 2
  • 10
  • 24
22
votes
4 answers

next-auth JWEDecryptionFailed

I am using this code to be able to use the credentials next-auth provider along with cognito as oauth serviice: this to allow email and password auth. I am running next-auth@4.2.1: import CognitoProvider from "next-auth/providers/cognito"; import…
a-dawg
  • 783
  • 1
  • 5
  • 13
22
votes
1 answer

Skip SignIn page with next-auth.js to go directly to provider

I am using Okta with next-auth.js. Since I'm only using 1 providers (I will be using more providers inside Okta login), may I just skip this page and go directly to Okta login page? If yes, how?
Boubou
  • 632
  • 5
  • 18
19
votes
1 answer

How to handle login failed error in NextAuth.js?

I'm using NextAuth.js for Next.js authentication. Login works fine, but the page is still reloading on wrong credentials. It doesn't show any error. I need to handle error to show some kind of toast message. signIn("credentials", { ...values, …
Yousuf
  • 241
  • 1
  • 2
  • 9
19
votes
3 answers

How to send httponly cookies client side when using next-auth credentials provider?

I'm creating a next js application, using next-auth to handle authentication. I have an external backend api, so I'm using Credentials Provider. The problem is that the backend sends httponly cookies, but those are not being attached to the browser…
Saul Montilla
  • 687
  • 6
  • 16
16
votes
6 answers

Get User ID from session in next-auth client

I'm using next-auth with Prisma and Graphql, I followed these instructions to set up the adapter and my models accordingly: https://next-auth.js.org/adapters/prisma Authentication works but when I inspect session object from here : const { data:…
Ivditi Gabeskiria
  • 302
  • 1
  • 2
  • 9
16
votes
3 answers

How to protect routes in Next.js next-auth?

I am trying to integrate authentication with next-auth library in an Application. I have been following the official tutorial given here https://github.com/nextauthjs/next-auth-example/. The problem with the given example is that I need to check if…
hafiz muhammed
  • 187
  • 1
  • 1
  • 7
16
votes
1 answer

ECONNREFUSED 127.0.0.1:80 when trying to sign in using next-auth

I use next-auth.js library to create authentication system for Next.js my application. Everything works fine on my local computer, but after deploying website to Vercel, my sign in function doesn't work. The sign in page (/pages/signin) loads fine,…
MateuszWawrzynski
  • 1,231
  • 2
  • 7
  • 15
15
votes
4 answers

How to Fix NO_SECRET warning thrown by Next-Auth

I have a Next js application that uses Next Auth. While in development I continuously keep getting that warning stipulating that I need to set a secret but I don't know where I should set it. Following this reference I see I just need to run openssl…
Laspeed
  • 791
  • 1
  • 5
  • 27
15
votes
7 answers

how to get the provider access token in next-auth

Hi I am new to nextjs and for authentication I am using next-auth. The users can log in using Google and when they are logged in and authenticated I want to get the access_token given by provider in this case Google. Although I can get that inside…
Mahdi-Jafaree
  • 882
  • 2
  • 9
  • 22
15
votes
2 answers

Pop-up login in next-auth

Is it possible to do a social login in Pop-up in next-auth? Or only possible redirecting to provider auth page? I'm asking because I don't want to lose all application state after redirect to a provider page. I don't want to save things in database…
Pedro Carvalho
  • 181
  • 1
  • 4
14
votes
3 answers

How to sync up the expiration time of Next Auth Session and a token coming from the server as I chose Credentials in provider of next-Auth

I have implemented a next-auth authentication system for my Next.js app. In the providers, I have chosen credentials because I have a node.js backend server. The problem that I am facing is the expiration of next auth session is not in sync up with…
Raghav
  • 161
  • 1
  • 2
  • 11
14
votes
2 answers

Next-Auth signIn with Credentials is not working in NextJS

I'm integrating next-auth package to my fresh Next.js project. I have followed all of the Next.js and next-auth documentations but not able to find a solution. The issue I'm facing goes like this: I want to Login to my Next.js app using Email &…
Lalith Kumar
  • 426
  • 1
  • 6
  • 10
1
2 3
99 100