nextauthjs / nextauthjs/next-auth

Cannot login after signout using Drizzle Adapter with Turso

Open
#8,377 3 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
TypeScript
Stars
28.4k
Forks
4k
PR merge metrics
No merged PRs in 30d

Description

Environment

System:
OS: Linux 6.1 Manjaro Linux
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Memory: 10.74 GB / 15.51 GB
Container: Yes
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.5.1 - ~/.nvm/versions/node/v20.5.1/bin/node
Yarn: 1.22.19 - /usr/bin/yarn
npm: 9.8.0 - ~/.nvm/versions/node/v20.5.1/bin/npm
pnpm: 8.6.12 - /usr/bin/pnpm

Reproduction URL

https://github.com/kyujulian/next-auth-login-issue

Describe the issue

When using drizzle-adapter package the adapter cannot retrieve the 'provider' and 'providerAccountId' on the database, causing the auth to throw OAuthAccountNotLinked Error when trying to login after a signout, even though there's only one provider.

DeepinScreenshot_select-area_20230821164958

How to reproduce

After going through the setup process on the reproduction URL,

Login with a given provider, signout then try to login again (with the same provider I configured only github for that reason) .

Expected behavior

Expected the adapter to link correctly to the account stored in the db.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction URL and trace the Drizzle adapter flow for the sign-in, signout, and repeat sign-in sequence using Turso. Check why the stored provider and providerAccountId are not retrieved, then verify that the configured GitHub account links successfully after signout and login again.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, nodejs, typescript
Domain
authentication, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.