Post user registration action doesn't send any data other than email

Hi there. Thank you for you impressive work.

I’m trying to migrate from hooks to actions and found that post registration action sends only email and nothing else. Here is the code of my action:

const axios = require("axios");

exports.onExecutePostUserRegistration = async (event) => {
  await axios.post(`${event.secrets.API_HOST}/register`, { 
    ...event.user
  });
};

and here is the data I get in my app:

{
  email: 'dergunov.web+3@gmail.com',
  username: undefined,
  id: undefined
}

I also tried to add something to axios request by myself, e.g.:

await axios.post(`${event.secrets.API_HOST}/register`, { 
  ...event.user,
  custom_id: 1
});

and I successfully got custom_id in my app.
What can cause it? I need at least email, username and id for successful registration on my side.

My tenant name is dev-p4e-5s5r
My user has email dergunov.web+3@gmail.com

Thanks.

Hi @lutaev,

Welcome to the Auth0 Community!

I understand you have issues sending the email, username, and user_id attributes with your Post-User Registration Action script.

First, I have gone ahead and tested the Action and did not find the same observations. When I check the event.user object, I can see the user profile attributes listed here.

Given that, have you made sure that your Database Connection has the Requires Username toggle enabled?

And, could you please try using the Real-time Webtask Logs Extension to see the complete event.user object during the signup flow?

Lastly, I double-checked your Action saved on your tenant, and there seem to have three dots prepended to the event.user which is syntactically incorrect. You’ll want to do something like the following:

  await axios.post(`${event.secrets.API_HOST}/register`, { 
    event.user,
    id: 1
  });

Looking forward to your reply.

Thank you.

1 Like

Thank you for your answer, it is really helpful. Looks like spread operator and destructuring are not supported by auth0, that was the reason.

1 Like

Hi @lutaev,

Thank you for your response and for providing the extra context.

I’m glad that everything is working now!

Please don’t hesitate to reach out if you have any further questions.

Thank you.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.