Skip to content
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

feat: drop user id generation in createUser #9381

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

balazsorban44
Copy link
Member

@balazsorban44 balazsorban44 commented Dec 13, 2023

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:

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.

Copy link

vercel bot commented Dec 13, 2023

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

@github-actions github-actions bot added adapters Changes related to the core code concerning database adapters dynamodb @auth/dynamodb-adapter neo4j @auth/neo4j-adapter pouchdb @auth/pouchdb-adapter upstash-redis @auth/upstash-redis-adapter typeorm @auth/typeorm-adapter drizzle @auth/drizzle-adapter kysely d1 azure-tables labels Dec 13, 2023
* fix: add default user id generation

* refactor: simplify `createUser` in adapters

* fix typeorm

* fix next-auth

* fix tests

* revert adapter changes

* revert

* revert

* simplify adapter util

* fix build errors
@ndom91
Copy link
Member

ndom91 commented Feb 12, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adapters Changes related to the core code concerning database adapters azure-tables d1 drizzle @auth/drizzle-adapter dynamodb @auth/dynamodb-adapter kysely mongodb @auth/mongodb-adapter neo4j @auth/neo4j-adapter pouchdb @auth/pouchdb-adapter typeorm @auth/typeorm-adapter upstash-redis @auth/upstash-redis-adapter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants