How to Add a Profile Image Upload Field in Auth0Lock SignUp Form?

Ready to post? :mag: First, try searching for your answer.
I’m using Auth0Lock to handle user signups in my application. The default additionalSignUpFields option allows me to add fields like full_name and phone_number, but I need to add an image upload field for the user’s profile picture during signup.

I attempted to add a custom outside the Lock widget, but this field does not appear in the signup form, and it doesn’t seem to integrate well with Auth0’s internal handling of user metadata.

Is there any way to extend the Auth0Lock widget to include a file input field for image uploads? If not, what would be the best approach to handle image uploads during signup while using Auth0Lock?

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <title>Sign In with Auth0</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" />
</head>
<body>
  <script src="https://cdn.auth0.com/js/lock/12.5/lock.min.js"></script>
  <script>
    var config = JSON.parse(decodeURIComponent(escape(window.atob('@@config@@'))));
    var lock = new Auth0Lock(config.clientID, config.auth0Domain, {
      auth: {
        redirectUrl: config.callbackURL,
        responseType: (config.internalOptions || {}).response_type ||
          (config.callbackOnLocationHash ? 'token' : 'code'),
        params: config.internalOptions
      },
      theme: {
        primaryColor: 'green'
      },
      additionalSignUpFields: [
        {
          name: "full_name",
          placeholder: "Enter your full name",
          validator: function(name) {
            return {
              valid: name.length >= 2,
              hint: "Must be at least 2 characters"
            };
          }
        },
        {
          name: "phone_number",
          placeholder: "Enter your phone number",
          validator: function(phone) {
            var phone_number_pattern = /^[0-9]{10}$/;
            return {
              valid: phone_number_pattern.test(phone),
              hint: "Must be a valid 10-digit phone number"
            };
          }
        }
      ]
    });

    lock.show();
  </script>
</body>
</html>

Hi @manastelavane999,

Welcome to the Auth0 Community!

Yes, you should be able to include an icon with your additionalSignUpFields.

For example:

var options = {
  additionalSignUpFields: [{
    name: "address",
    placeholder: "enter your address",
    // The following properties are optional
    icon: "https://example.com/assests/address_icon.png",
    prefill: "street 123",
    validator: function(address) {
      return {
         valid: address.length >= 10,
         hint: "Must have 10 or more chars" // optional
      };
    }
  }
}

I recommend reviewing our Lock configuration -additionalSignUpFields documentation.

Let me know if you have any questions.

Cheers,
Rueben

Hi Rueben,

Thank you for your previous help with adding icons to the additionalSignUpFields. However, I need further assistance.

I’m trying to add an image upload field to the Auth0Lock widget so users can upload a profile picture during signup. I noticed that additionalSignUpFields supports basic input types like text and phone numbers, but I’m not sure how to include a file input for image uploads.

Is it possible to extend the Auth0Lock widget to support an image upload field directly? If not, could you suggest the best workaround for handling image uploads during the signup process while still using Auth0Lock?

Thank you for your guidance!

1 Like

Hi @manastelavane999,

Thanks for the reply and clarification.

Aha, I understand now. You were trying to see if it’s possible to have an image upload field so users can upload a profile picture during signup.

I have looked into this further and discovered that an image upload field is not currently possible. The additionalSignUpFields is designed to collect text-based inputs like text, options, or checkboxes.

It might be worth submitting a feedback request asking to support this feature.

As a workaround, you might be able to make it work by using a Redirect Action to redirect your users to a custom page to have them upload the image. You might need to save the image as a URL in the picture root profile attribute for this to work.

(Reference: User Profile Structure)

I hope this helps!

Thanks,
Rueben

1 Like

Hi Rueben,

Thank you for looking into this and clarifying the limitations of the additionalSignUpFields. I appreciate the suggestion of using a Redirect Action to handle the image upload on a custom page. That seems like a practical approach.

Best regards,
Manas Telavane

1 Like

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