I have configured every correctly on the google cloud environment and also code correctly. When I sign in, will receive an erorr saying “Try signing in with a different account”. I have created a new test user on the google cloud, but the situation remains the same. Any clue what is happening and how to fix this?
Same here, did you find solution?
solved
To address this, I updated the @next-auth/prisma-adapter
dependency to the latest version. After updating, the issue was resolved, and authentication worked correctly.
To resolve this issue in your project, you can try updating the @next-auth/prisma-adapter
dependency by running npm update @next-auth/prisma-adapter
I had the same issue, and came to the same solution.
As Mosh said, Next-auth is going through some transition, it is confusing as which library, @next-auth / @auth, and which version to use.
I updated to the latest version of next-auth/prisma adatper (1.0.7) and I am still unable to log in. Any other ideas would be appreciated. Thank you.
I thought I’d try one more time to get this issue resolved. I have updated to the latest version of the next-auth prisma adapter.
Everything works if I disable the adapter by updating the auth route to look like this:
import NextAuth from "next-auth/next";
import GoogleProvider from "next-auth/providers/google"
import { PrismaAdapter } from "@next-auth/prisma-adapter";
import prisma from '@/prisma/client'
import { NextAuthOptions } from "next-auth";
export const authOptions:NextAuthOptions = {
//adapter: PrismaAdapter(prisma),
providers:[
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID!,
clientSecret: process.env.GOOGLE_CLIENT_SECRET!
})
],
//session: {strategy:'jwt'}
};
const handler = NextAuth(authOptions);
export {handler as GET, handler as POST}
As you can see, I commented out the lines that configure the adapter. With this change I can log into the app with my GMail account. But I’d like to get the adapter to work.
Any advice would be much appreciated, thanks!
I updated to the latest version of next-auth/prisma adatper (1.0.7) and I am still unable to log in. Any other ideas would be appreciated. Thank you.
Alright, guys, I nailed it.
First, you have to make sure @next-auth/prisma-adapter
is up to date (as of today it’s 1.0.7)
Then, make sure you copy the schema from the new Auth.js site. (here) Not the old Next-Auth site, there are some teeny-tiny difference that would cause some mySQL errors. If you have already run prisma migration as per the video at this point, don’t worry just delete the last migration folder, paste the new schema and overwrite, then run the migration again.
Finally, I did these things in these orders: rerun npm run dev, go to cookies and clean the localhost:3000, go to signout page and signout, go to signin page and sign in. Boom, I’m in.
Hope this helps. Cheers:)
Thanks @polycozy, it worked. Not sure what was the issue, I tried several times, several days, but was not working.
Hi guys i tried all the solutions but still the issue remains. actually i cant continue with course due to this. Any solution?
Hello, I also updated to latest version of @next-auth/prisma-adapter and still not working, please help
Ok, I got it to work:
Make sure that if you modify the schema.prisma file you run again the command ‘npx migrate prisma dev’ in order to push the changes to the DB