After updating email and verifying token, user_metadata still has the old email
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- go, javascript, node.js
- Domain
- api, authentication, backend
Research direction
Start at the updateUser and verifyOtp entry points and reproduce the flow with supabase-js 2.42.3 and auth-js 2.63.0. Compare the returned session and auth.users after email verification; done means the new verified email is reflected in user_metadata as well as email and identities.
Written by the indexing model from the issue text.
Description
Bug report
- I confirm this is a bug with Supabase, not with my own application.
- I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
After updating a user's email and verifying with OTP token, the user_metadata field isn't updating with the newly verified email.
The email and identities field get correctly updated.
Secure email change is disabled.
To Reproduce
- call
updateUser({ email: "email2@gmail.com" }) - call
verifyOtp({ email: "email2@gmail.com", token: token, type: "email_change" }) - the session that verifyOtp returns has the old email still in the
user_metadatafield - in the auth.users table, the
user_metadatafield still has the old email
Expected behavior
The user_metadata field should be updated with the new email
System information
- OS: mac
- Version of supabase-js: "2.42.3"
- Version of auth-js: "2.63.0"
- Version of Node.js: "18.13.0"
Additional context
session returned from verifyOtp
{
"app_metadata": {
"provider": "email",
"providers": [
"email"
]
},
"aud": "authenticated",
"confirmation_sent_at": "2024-07-21T00:41:57.424722Z",
"confirmed_at": "2024-07-21T00:42:04.984262Z",
"created_at": "2024-07-21T00:41:57.40992Z",
"email": "email2@gmail.com",
"email_change_sent_at": "2024-07-21T01:03:21.984546Z",
"email_confirmed_at": "2024-07-21T00:42:04.984262Z",
"id": "88e3b62a-54ef-4c49-963d-c09de3a09cd1",
"identities": [
{
"created_at": "2024-07-21T00:41:57.418971Z",
"email": "email2@gmail.com",
"id": "88e3b62a-54ef-4c49-963d-c09de3a09cd1",
"identity_data": [],
"identity_id": "3fba5840-9614-4066-a38b-8d89e6a7cff6",
"last_sign_in_at": "2024-07-21T00:41:57.418919Z",
"provider": "email",
"updated_at": "2024-07-21T00:55:58.797144Z",
"user_id": "88e3b62a-54ef-4c49-963d-c09de3a09cd1"
}
],
"is_anonymous": false,
"last_sign_in_at": "2024-07-21T01:03:32.004548674Z",
"phone": "",
"role": "authenticated",
"updated_at": "2024-07-21T01:03:32.008945Z",
"user_metadata": {
"age": 48,
"email": "email1@gmail.com",
"email_verified": false,
"phone_verified": false,
"sub": "88e3b62a-54ef-4c49-963d-c09de3a09cd1",
"username": "ee"
}
}
- Dominant language
- Go
- Stars
- 2.6k
- Forks
- 764
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 39
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from supabase/auth
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Similar issues
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
blinklabs-io/bursa#904 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
yanet-platform/ipfw-go#129 ·
-
bug confmap/provider/googlesecretmanagerprovider needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
open-telemetry/opentelemetry-collector-contrib#51273 · 2 comments ·
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100