John
John

Reputation: 323

auth0 - invalid user_metadata.address type (only strings are allowed)

I am using Auth0 for user management in my application. I am trying to signup by using this code:

signup({
  name: `${data.given_name} ${data.family_name}`,
  given_name: data.given_name,
  family_name: data.family_name,
  connection: AUTH0_CONNECTION,
  username: data.email,
  email: data.email,
  password: data.password,
  userMetadata: {
    accept_terms: data.accept_terms.toString(),
    job_title: data.job_title,
    certificate_image_id: data.certificate_image_id,
    company_name: data.company_name,
    phone_number: data.phone_number,
    certificate_image_url: data.certificate_image_url,
    website: data.website,
    address: {
      zipcode: data.zipcode,
      address1: data.address1,
      address2: data.address2,
      city: data.city,
      country: data.country,
      state: data.state,
    },
  },
})
  .then((response) => {
    console.log("You're successfully Registered!");
  })
  .catch(() => {
    console.log("Error Occured!");
  })
  .finally();

In the roles of user MetaData of Auth0, there are not more than 10 fields. That is why I moved the address fields to another address object. But, it throws an error invalid user_metadata.address type (only strings are allowed). I need all these fields.

Kindly help me to solve this problem. Thanks

Upvotes: 0

Views: 104

Answers (1)

Tamil M
Tamil M

Reputation: 11

It seems like auth0 only let's you have max of 10 string fields when using the sign up endpoint (source). You can either stringify the address and store it in one string field or sign up the user and then add the address later on.

Upvotes: 0

Related Questions