After updating email and verifying token, user_metadata still has the old email
budget-share-admin opened this issue · comments
budget-share-admin commented
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_metadata
field - in the auth.users table, the
user_metadata
field 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"
}
}
budget-share-admin commented
any updates here?