Post Registration Hook - User Properties Not Pulling In


We are currently using a post registration web-hook to do a bit of custom functionality.
The JSON used when testing the web-hook through the interface looks like this

  "user": {
    "id": "abc123",
    "tenant": "my-tenant",
    "username": "user1",
    "email": "",
    "emailVerified": true,
    "phoneNumber": "1-000-000-0000",
    "phoneNumberVerified": true,
    "user_metadata": {
      "hobby": "surfing"
    "app_metadata": {
      "plan": "full"
  "context": {
    "requestLanguage": "en-us",
    "connection": {
      "id": "con_xxxxxxxxxxxxxxxx",
      "name": "Username-Password-Authentication",
      "tenant": "my-tenant"

When printing out the user object i can see that the name property is set. However when creating a user using the /dbconnections/signup on the management API, setting any of the other use properties such as name, given_name, nickname etc, these don’t pull through into the hook when i print out the user object.

It seems silly to have to set the name in the user_metadata property to access it


Hi @darren.tiplady,

when i print out the user object.

How do you print out the user? Is this in your client application, or via console log in the hook and checking the webtask realtime logs (asking cause the latter wouldn’t work in a post-reg hook due to asynchronisity)?

What’s the code of your hook?

Hi Mat,

The user is being printed out when i was testing the hook via the webtask realtime logs. Screenshot below.

When testing from my application i let the code run through the management API’s endpoint


I then checked the log of the web-hook to see what the user object is that was printed out was. As an example this is what was printed out .


Webhook below.

@param {object} user - The user being created
@param {string} - user id
@param {string} user.tenant - Auth0 tenant name
@param {string} user.username - user name
@param {string} - email
@param {boolean} user.emailVerified - is e-mail verified?
@param {string} user.phoneNumber - phone number
@param {boolean} user.phoneNumberVerified - is phone number verified?
@param {object} user.user_metadata - user metadata
@param {object} user.app_metadata - application metadata
@param {object} context - Auth0 connection and other context info
@param {string} context.requestLanguage - language of the client agent
@param {object} context.connection - information about the Auth0 connection
@param {object} - connection id
@param {object} - connection name
@param {object} context.connection.tenant - connection tenant
@param {object} context.webtask - webtask context
@param {function} cb - function (error, response)
module.exports = function (user, context, cb) {

    console.log('User: o%', user);
    // Constants
    const request = require('request-promise');
    const sgMail = require('@sendgrid/mail');
    const auth0verificationEmailUrl = '';
    const sendGridApiKey = context.webtask.secrets['sendgrid-apikey'];
    const firmSignupClientId = context.webtask.secrets['firm-signup-client-id'];
    const firmSignupClientSecret = context.webtask.secrets['firm-signup-client-secret'];
    // Email Replacement Variables
    const displayName = user.user_metadata.firstname;
    const user_id = 'auth0|' +;
    var verify_email_Template;
    // Auth0 Access Token
    var accessToken;
    // Auth0 Access Token Request Options
    var accessTokenOptions = {
        method: 'POST',
        url: '',
          grant_type: 'client_credentials',
          client_id: firmSignupClientId,
          client_secret: firmSignupClientSecret,
          audience: ''
        resolveWithFullResponse: true
    // Main Request
        .then(function onSuccess(response) {
            if (response.statusCode == 400)
                console.log('Invalid model received %o', response);
            if (response.statusCode == 200) {
                // Save the access token
                accessToken = JSON.parse(response.body);
            // Auth0 Verification Email Settings
            var verifyEmailOptions = {
                method: 'GET',
                url: auth0verificationEmailUrl,
                headers: { 'Authorization': 'bearer ' + accessToken.access_token },
                resolveWithFullResponse: true
            // Get the verification email template
                .then(function onSuccess(response) {
                    if (response.statusCode == 400)
                        console.log('Invalid model received %o', response);
                    if (response.statusCode == 200) {
                        verify_email_Template = response.body.replace(/user_id/g, user_id)
                            .replace('{{ user.app_metadata.displayName }}', displayName);
                        // Parse Template to JSON
                        jsonVerificationTemplate = JSON.parse(verify_email_Template);
                        // Setup SendGrid Email
                        const msg = {
                            from: jsonVerificationTemplate.from,
                            subject: jsonVerificationTemplate.subject,
                            content: [
                                    type: 'text/html',
                                    value: jsonVerificationTemplate.body
                        // Send mail
                            .then(() => {
                                console.log('Success SendGrid Mail Sent');
                            .catch(error => {
                                //Log friendly error
                                //Extract error msg
                                const { message, code, response } = error;
                                //Extract response msg
                                const { headers, body } = response;
                    // Ensure callback is called on each path
                    }).catch(function onError(err) {
            // Ensure callback is called on each path
        }).catch(function onError(err) {

To add to this, user.picture is also not available during the post-registration hook even though it is part of the normalized user profile.

1 Like

Any updates on this please? I’m facing the same problem.

Same problem here. Any updates…? It’s been a while now