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

NextAuth v4 Credentials Provider not returning Id

I am trying to learn next-auth, I finally got the login to work but when I pass the id from the user in the database it doesn't show up in the session only the values that I provided null to show up import NextAuth from 'next-auth' import…
bobby_turks
  • 75
  • 1
  • 6
0
votes
0 answers

Twitter authentication is not working in nextjs using next-auth

Screenshot of the twitter authentication error import NextAuth from 'next-auth' import TwitterProvider from 'next-auth/providers/twitter' export default NextAuth({ // Configure one or more authentication providers providers: [ …
0
votes
1 answer

NextJs creating user document in mongodb after google sign in

i want to create a user document after i sign in with google in my nextjs application. I can sign in but it's not creating the document after it. This is my function const handleSignIn = async () => { try { await signIn("google"); …
José Carlos
  • 626
  • 3
  • 23
0
votes
2 answers

How to sign out using the POST /api/auth/signout endpoint with Next Auth?

This Reddit post suggests to make "an api call in signOut event. The backend handled the rest of it." Sure, so let's write it : await fetch('/api/auth/signout', { method: "POST" }); Except the request is redirected through a 302 to GET…
Yanick Rochon
  • 51,409
  • 25
  • 133
  • 214
0
votes
0 answers

NextAuth signIn callbackUrl based on authenticated user role

I made a single custom login page for all users, and I am trying to redirect the user to his dashboard based on his role. I am using next-auth credentials provider and I am flashing the user's role to the session. Login page: const LoginPage:…
Ismail_Aj
  • 332
  • 1
  • 4
  • 17
0
votes
0 answers

next.js: Setup next-auth role based credentials auth with prisma (ikm error)

I'm trying to set up role based authentication in next.js using next-auth and prisma but when I try to call signIn() function I get a weird error error - TypeError: "ikm"" must be an instance of Uint8Array or a string. The signIn()function invokes…
Ismail_Aj
  • 332
  • 1
  • 4
  • 17
0
votes
1 answer

Next-Auth.js problem with Twitter Authorization

I am trying to configure my web app to login via various social medias. I am using next and next-auth. I have gotten connection with Github through Next-Auth to work. However, Twitter is giving me issues. When I was using Twitter API v1.1 I was…
0
votes
1 answer

custom verify request page for next auth is not loading after sign in

using next auth with custom verify request page but it won't load after sign in (i.e. the page hangs or just stays on the same page it was already on) because of the following error, anyone know the reasoning? API resolved without sending a response…
user3226932
  • 2,042
  • 6
  • 39
  • 76
0
votes
1 answer

Unable to invoke "btoa" and "item.slice" method in my script for retrieving the playlist

Whenever I am trying to invoke the "btoa" method, I am not able to use this within my script. I created a variable to store the client id: client_secret in base64. The id and secrets are being retrieved from the ".env" file. I have also tried to use…
0
votes
2 answers

[MissingAPIRouteError]: Cannot find [...nextauth].{js,ts} in /pages/api/auth. Make sure the filename is written correctly. But its already there

Couldn't find a result from browsing. I keep getting this error, although it worked fine when I first built this app, I can't get through authentication in deployed app as well as different machines. It says that it can't find [...nextAuth].js…
0
votes
1 answer

Next-auth does not redirect users after successful login with github

I checked docs serval times. My issue is when users successfully log in with the help of GitHub. User automatic redirect to dashboard my dashboard on the '/' page. but it is not working in next-auth. I think errors are related to redirection. but I…
0
votes
0 answers

Cannot get the additional detail i.e account id from session callback using Next_auth

I want to extract account id as additional detail from session callback using Next_auth. Whatevere I add in jwt token and pass it to session callback still it returns the same data. I tried logging out and loggin in many times but all in vain. Any…
0
votes
3 answers

Next-auth redirects me back to dashboard after logout

I have a credential based auth flow in NextJS and a dashboard page I have also created custom AccessDenied component in case it not logged used would end up on the dashboard route, hence I did not set redirect in the getServerSideProps where I fetch…
seven
  • 1,183
  • 14
  • 33
0
votes
1 answer

How to update user image across all components (without page refresh)

I think this question is related to how React apps are written in general. For user sessions I use - NextAuth.js All user data (incl profile image) from NextAuth is stored on Supabase (PostgreSQL) How to show user's new profile image across…
aivarastee
  • 81
  • 2
  • 12
0
votes
2 answers

Property 'accessToken' does not exist on type '{ name?: string | null | undefined; email?: string | null | undefined;

I have a session value from next auth useSession hook , my session callback method is this : async session({ session, token }) { console.log(token); session.user.accessToken = token.accessToken; session.user.refreshToken = token.refreshToken; …
Mohamed Nabil
  • 525
  • 2
  • 9
  • 24