When (and how) do I send custom metadata like display name when doing phone login with Supabase Auth

Hey everyone! I'm implementing phone number login with OTP using Supabase Auth in my Go backend. Right now I’m doing the usual flow: POST /auth/v1/otp with phone number to request the OTP POST /auth/v1/verify with the token and phone number to log the user in Everything works fine. But I want to attach additional metadata during the login or user creation process — like a display_name or referral_code. My questions: Is it possible to send metadata (like display_name) during the OTP flow? If not, is the only option to wait until after the /verify call and then update the user with a separate API call? How are you guys handling this flow when using phone number logins and want to set custom data for users? I searched the docs and couldn’t find any mention of metadata support for phone OTP logins. Any help, best practices, or pointers would be nice, Thank you in advance
2 Replies
Gaslit By Tech
Gaslit By Tech2mo ago
I haven't used it though I have seen the signInWithOtp has an optional data property:
(property) data?: object | undefined A custom data object to store the user's metadata. This maps to the auth.users.raw_user_meta_data column.  The data should be a JSON object that includes user-specific info, such as their first and last name.
in frontend/node_modules/@supabase/auth-js/src/GoTrueClient.ts so I assume you can do this in the golang client too.
silentworks
silentworks2mo ago
I'm going to recommend to do this after the user has signed up. It takes away all the headache of achieveing this with all the different auth flows. For instance signInWithOAuth doesn't have a data property for additional data, so you would have to collect this after the user signs in anyway.

Did you find this page helpful?