next-auth icon indicating copy to clipboard operation
next-auth copied to clipboard

feat: drop user id generation in `createUser`

Open balazsorban44 opened this issue 2 years ago • 2 comments

Since this is a repetitive task that many adapters decided to do themselves, the parent libraries have been updated to not require adapters to generate an id themselves.

Before this can be merged:

  • [x] Depends on #9380
  • [ ] upgrade in v4 (related #9493, #9699)
  • [ ] fix https://github.com/balazsorban44/monorepo-release/issues/10

BREAKING CHANGE:

The adapter now requires the parent library (either @auth/core or next-auth v4) to send the id property in the createUser method. Make sure to upgrade your parent library to their latest version.

The parent library generates the id via crypto.randomUUID(). If your custom adapter needs a different format, you can easily patch the createUser(method) to ignore the incoming id, or override it with your own type of id.

balazsorban44 avatar Dec 13 '23 04:12 balazsorban44

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auth-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 21, 2023 3:02pm
2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
auth-docs-nextra ⬜️ Ignored (Inspect) Visit Preview Dec 21, 2023 3:02pm
next-auth-docs ⬜️ Ignored (Inspect) Visit Preview Dec 21, 2023 3:02pm

vercel[bot] avatar Dec 13 '23 04:12 vercel[bot]

Do you still plan on "backporting" this for v4?

I think with that recent "always set UUID to fallback user.id" PR in core, this could basically be good to go for v5.

What do you think?

ndom91 avatar Feb 12 '24 20:02 ndom91