next-auth: Encountering OAuthAccountNotLinked Error on Subsequent Google Sign-Ins [Drizzle ORM]
Adapter type
Environment
System:
OS: macOS 14.3.1
CPU: (11) arm64 Apple M3 Pro
Memory: 178.80 MB / 18.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.11.1 - /usr/local/bin/node
npm: 10.2.4 - /usr/local/bin/npm
pnpm: 8.15.3 - /usr/local/bin/pnpm
Watchman: 2024.01.22.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 121.0.6167.184
Edge: 121.0.2277.128
Safari: 17.3.1
npmPackages:
@auth/drizzle-adapter: ^0.7.0 => 0.7.0
next: 14.1.0 => 14.1.0
next-auth: 5.0.0-beta.11 => 5.0.0-beta.11
react: ^18.2.0 => 18.2.0
Reproduction URL
https://github.com/wpcodevo/nextauth-nextjs14-drizzle/tree/main
Describe the issue
We’re experiencing an issue where users receive an OAuthAccountNotLinked error when they attempt to sign in with Google after their initial account creation and sign-out. Despite implementing allowDangerousEmailAccountLinking: true, our database shows duplicate entries in the accounts table for the same user upon a second and subsequent sign-in attempt.
The repo link uses beta-8 but it also happens with beta-11.
How to reproduce
- User signs up with Google OAuth provider.
- User signs out.
- User attempts to sign in again with the same Google account.
- The
OAuthAccountNotLinkederror occurs.
Expected behavior
The expected behavior is that a user should be able to sign in with the same Google account multiple times without encountering linking issues, assuming allowDangerousEmailAccountLinking: true is set to allow email-based account linking.
About this issue
- Original URL
- State: open
- Created 4 months ago
- Reactions: 1
- Comments: 15 (6 by maintainers)
Ah gotcha, yeah those are exported from the sveltekit package now as well 👍
We wanted to avoid having people have to install both packages
Thank you @ndom91 for the help, looks like upgrading to 0.13.0 helped and using the updated instructions that you provided!
I uninstalled the CorePackage as well but I used it to get a typed type of the Account type in the “account” table