Signup via api: setting user metadata first name and last name

Hi there,

I’m using Auth0 + wordpress plugin to authenticate. This works fine.

For signups I use the api via http post request. I want to add user_metadata to the signup (first name and last name)…can anyone give me a hint how to create the post-call correctly to include user_metadata for firstname and lastname?

  1. When logging in the first time I want auth0 to hand over the user_metadata (first and last name ) to wordpress so the names are set correctly. How to I have to modify the rules so auth0 also sets first name and last name when creating the wordpress user during the first login?


Hi @admin37,

Thanks for reaching out to the Auth0 Community!

I understand you have questions about setting the user’s user_metadata (first name and last name) when creating users.

  1. When using the Management API create a user’s endpoint, you can specify the user_metadata properties in the request body:
  "email": "",
  "connection": "Initial-Connection",
  "password": "secret",
  "user_metadata": {
      "first_name": "John",
      "last_name": "Doe "
  1. There is an option to make a WordPress API call within an Auth0 Action to pass the user_metadata values. Moreover, you can check for the user’s logins_count to allow this to only happen for the user’s first successful login.

For example:

exports.onExecutePostLogin = async (event, api) => {
  if (event.stats.logins_count === 1) {
    var firstName = event.user.user_metadata.first_name
    var lastName = event.user.user_metadata.last_name

I hope this helps!

Please let me know how this works for you.

Thank you.