Last Updated: Jun 17, 2024
Overview
How to configure additional signup fields on the Universal Login page.
Applies To
- Universal Login Page
- Additional Signup Fields
Solution
An answer to the question, a workaround or a fix to a problem, including links to external documentation that the customer may reference. It’s not necessary to know the solution while drafting a knowledge article.
There are a few requirements for this to work:
- Tenant must use a Custom Domain.
- A Custom Page Template should be configured.
- Ensure the Customize Login Page toggle has been disabled for Login Prompts.
NOTE: Data capture is only available for users who use an email and password to sign up or login.
Prompt customization is now available out of the box. Refer to the Customize Signup and Login Prompts documentation for additional information.
Follow the video or steps below.
For example, if adding the Full Name field to the sign-up widget, follow these steps.
- On the Dashboard, navigate to Applications > APIs.
- Click on Auth0 Management API.
- Click API Explorer and copy the token.
- Go to the Management API Explorer.
- Click the Set API Token button and paste the API Token from step 3.
- Click the Set Token button.
- Select the prompt type - signup.
- In the body field, build the syntax that is needed.
Example Body:
> {
> "signup": {
> "form-content-start": "<div class='ulp-field'><label for='full-name'>Full Name</label> <input type='text' name='ulp-full-name' id='full-name'></div>"
> }
> }
NOTE: Object properties such as signup or from-content-start must be in double quotes, the same as the string value containing the HTML element. The HTML element properties must use single quotes.
- Click on Test Endpoint and confirm a 200 response code is received.
Example Pre-User Registration action:
exports.onExecutePreUserRegistration = async (event, api) => {
const fullName = event.request.body['ulp-full-name'];
if(!fullName) {
api.validation.error("invalid_payload", "Missing Name");
return;
}
api.user.setUserMetadata("fullName", fullName);
};