-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When using prisma adapter, user can login only one time #12456
Comments
I'm having the same issue with drizzle and neon. I just posted this in discord.
I don't have the This is my Teachable Provider. It works fine with the
|
In my case I see a new provider id for each login and that also seems wrong. @rhufsky I think you would need to remove the constraint you have to test that, but I'd be curious if you see different provider ids for Gitlab. |
@rhufsky I think I might have it figured out. It looks like AuthJS expects an
Because the email is a unique constraint for Teachable and most if not all providers, I believe this is a valid solution. Edit: |
I just used the existing Gitlab Provider, so maybe my problem is in the Gitlab Provider. I did not remove the constraint but logging in the second time I get
This looks like the AuthJS tries to create a second When setting I guess that the whole thing is intended to work like so:
This makes sense as For some reason, Auth.js tries to create a new |
I encountered the same issue with Next.js 15, Auth.js 5 Beta-25, PostgreSQL (Supabase) and Prisma, where the OAuthAccountNotLinked error kept popping up. It had me stumped for days—I was convinced my code was broken. What eventually worked for me was deleting all the tables related to the Auth system (Account, Authenticator, Sessions, User, VerificationToken) and re-pushing my schema. It seemed a bit drastic, but as soon as I did this, everything worked perfectly. The problem appeared to be related to inconsistent data in the tables. For instance, sign-in data was populating the User table but not the Account table, leading to the error: "To confirm your identity, please sign in with the same account." If you're facing this error, it's definitely worth a try. Hope this helps someone. |
Environment
Reproduction URL
https://github.com/rhufsky/authdemo
Describe the issue
Using a prisma adapter and gitlab Provider
Reading https://errors.authjs.dev#oauthaccountnotlinked, we see that
While I can understand that, I also see that prisma adapter has created the user and account entries by itself, so it should allow login.
The docs also state that
This is a nice solution but as far as I understand the process, this is not an option but rather a workaround that MUST be applied.
How to reproduce
Uncomment the prisma adapter entries and try to login two times.
Expected behavior
Auth.js should allow users for more that one time.
Note
I also tried the prisma adapter for MySQL, I also set
allowDangerousEmailAccountLinking: true
and at the second login I gotIn this case it seems that the adapter wants to create an account entry every time the user logs in ...
The text was updated successfully, but these errors were encountered: