https://supabase.com/ logo
#help
Title
# help
s

StickSeas

04/04/2022, 8:31 PM
Hello Everyone. I can't get user metadata to save in Supabase when creating the user using supabase.auth.api.createUser().
Copy code
const { data: user, error } = await supabase.auth.api.createUser({
    email: username,
    password: password,
    data: {
      first_name: first,
      last_name: last,
      address: address
    }
  });
This always ends up having the user_metadata as a blank object.
Copy code
console.log(user);
{
  id: 'deg84a9f-334e-8v6s-81bd-87dd864e0t187',
  aud: 'authenticated',
  role: 'authenticated',
  email: 'email@email.com',
  phone: '',
  app_metadata: { provider: 'email', providers: [ 'email' ] },
  user_metadata: {},
  identities: null,
  created_at: '2022-04-04T19:14:21.704112Z',
  updated_at: '2022-04-04T19:14:21.705655Z'
}
n

Needle

04/04/2022, 8:31 PM
Hello @StickSeas! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
/title
command! We have solved your problem? Click the button below to archive it.
StickSeas (2022-04-04)
g

garyaustin

04/05/2022, 12:30 AM
After looking at the source code and guessing at some things.... the docs seem incorrect... I could only get metadata with this...
Copy code
const { data: user, error } = await supabase.auth.api.createUser({
        email: 'user@email.com',
        password: 'password',
        user_metadata: {
            name: 'Yoda'
        }
    }
note the use of user_metadata versus documented data.... Sigh
s

StickSeas

04/06/2022, 5:47 PM
Awesome, that was it! VS Code gave me intellisense of user_metadata as I was typing... I hope they fix the docs for the server stuff. Thanks @garyaustin
g

garyaustin

04/06/2022, 7:13 PM
Already been updated for that, I filed a report.