Development Resources

Register Customer in Storefront

To register a customer, you implement the following steps:

  1. Show the customer a form to enter their details.
  2. Send a POST request to the /auth/customer/emailpass/register API route to obtain a JWT token.
  3. Send a request to the Create Customer API route pass the JWT token in the header.

For example:

In the above example, you create a handleRegistration function that:

  • Obtains a JWT token from the /auth/customer/emailpass API route.
  • Send a request to the Create Customer API route, and pass the JWT token as a Bearer token in the authorization header.
  • Once the customer is registered successfully, you can either redirect the customer to the login page or log them in automatically as explained in this guide.
Was this page helpful?
Edit this page