Accessing Forms for Actions submission data in postLogin Action directly

Hi all,

I am using the new Forms for Actions flow with Universal login to collect additional user information at the time of sign up.

In the form I am collecting the user’s first name and last name. I intend to use this data to call one of my own APIs to create an account for my service with the user’s first and last name included in the payload.

I would prefer not to have to store the user’s first and last name on the Auth0 user profile or in the user_metadata object.

I have tried using Flows HTTP Request option, but it doesn’t really suit the way my API needs to be called or authenticated against.

I would prefer to have the data available to me in the Auth0 Action as it is a lot more flexible and suits my needs for calling my API better.

Is there a way to access Forms for Actions submission data in an Auth0 Action directly?

Hello!
To access Forms for Actions submission data in an Auth0 Action directly, you can use the api.prompt.render method. This allows you to pass values from the form submission to your Auth0 Action.

Thanks for the reply!

Would you be able to give me an example code snippet or point to documentation of how to do this in more detail? I can’t seem to find anything in the documentation outlining this.

Thanks in advance!

UPDATE:

I have found documentation on how to access form submission data from within a Post-Login Action.

You can render the form using api.prompt.render(FORM_ID) in the onExecutePostLogin() method.

The form submission data will then be available in the onContinuePostLogin() method within the same Action via the event.prompt.fields object. You can access the form data based on their field IDs defined in the Form.

Documentation for Rendering Forms using Actions > Fields and shared variables data in Actions

Hope this helps someone else!

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