---
schema_version: "1"
id: 52d3043be39846bb82267872322a3f5d2fb62d788114203421f6fcda2f769b7f
title: Register a Customer with Passwordless Login
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/commerce-cloud/commerce-api/guides/slas-passwordless-login-registration.md
canonical_url: https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/slas-passwordless-login-registration.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 95423bc8dcc1d65cb7c083e7a562817f6d9e9b995f1bab9b43e2b2b9dfcd12ad
products:
  - Composable Storefront
  - Salesforce APIs
---
# Register a Customer with Passwordless Login

Starting with B2C Commerce version 26.1, the passwordless login flow supports customer registration. By passing additional parameters in the authorization request and validating a time-based one-time password (TOTP), create a B2C Commerce customer profile without requiring a password.

## Overview

To understand how passwordless login with registration works, let’s look at an overview of the process.

![SLAS passwordless login flow with customer registration](https://developer.salesforce.com/docs/media/commerce-api/slas-passwordless-login-registration.png '{"class": "image-xl"}')

1. The shopper requests a passwordless login and registers as a new customer. Your app calls the [authorizePasswordlessCustomer](https://developer.salesforce.com/docs/commerce/commerce-api/references/auth?meta=authorizePasswordlessCustomer) endpoint and provides a callback URI.
2. SLAS makes an HTTP POST request to your callback URI, including the shopper’s contact information and an eight-digit TOTP.
3. The app sends the TOTP to the shopper over email, SMS, or another mechanism.
4. The shopper provides the TOTP to the app either by clicking a link or entering it manually. Your app calls the [getPasswordLessAccessToken](https://developer.salesforce.com/docs/commerce/commerce-api/references/auth?meta=getPasswordLessAccessToken) endpoint to authenticate the shopper.
5. After successful validation of the `pwdless_login_token` (TOTP), or `login_id + pwdless_login_token`, SLAS requests a new customer profile.
6. B2C Commerce creates the new customer profile.
7. SLAS returns the access and refresh tokens. The access token can be used to make authorized requests on behalf of the shopper.

## Configure Passwordless Login with Registration

To implement passwordless login with customer registration, first authorize the customer and then validate the TOTP.

### 1. Authorize the Passwordless Customer with Registration

Call the [`authorizePasswordlessCustomer`](https://developer.salesforce.com/docs/commerce/commerce-api/references/auth?meta=authorizePasswordlessCustomer) endpoint with the `register_customer` query parameter set to `true`. For customer registration, the request body requires the additional parameters `email` (unless the `user_id` parameter already provides an email) and `last_name`. The `phone_number`, `first_name`, and `customer_no` parameters are optional, but recommended if available.

```text
#!/bin/bash
set -euo pipefail

# Update these values with your configuration:
CODE='qw1ert23'
ORG='f_ecom_abcd_001'
CLIENT='my-slas-private-client-id'
SECRET='my-slas-private-client-secret'
SITE='my-ecom-site'
CALLBACK='https://www.example.com/my-callback-url?secret=open-sesame' LOGIN='testuser@salesforce.com'

BASE="https://$CODE.api.commercecloud.salesforce.com/shopper/auth/v1/organizations/$ORG"
curl "$BASE/oauth2/passwordless/login?register_customer=true" \
    --user "$CLIENT:$SECRET" \
    --data "channel_id=$SITE" \
    --data 'mode=callback' \
    --data "callback_uri=$CALLBACK" \
    --data-urlencode "login_id=$LOGIN" \
    --data 'last_name=User' \
    --data 'email=testuser@salesforce.com' \
    --data 'first_name=Test' \
    --data 'phone_number=+10001112222'
    --data 'customer_no=CC147852963'
```

As described in the [passwordless login flow without registration](https://developer.salesforce.com/docs/commerce/commerce-api/guide/slas-passwordless-login.html#passwordless-login-implementation), SLAS then makes an HTTP POST request to the specified callback URI. The JSON payload includes a TOTP to send to the shopper.

**important:** The B2C Commerce customer profile isn't created by the call to authorizePasswordlessCustomer. After you call the authorizePasswordlessCustomer endpoint, exchange the TOTP from the callback for an access token (step 2) to complete registration.

### 2. Validate the TOTP and Create Customer Profile

To register the customer, call the `[getPasswordLessAccessToken](https://developer.salesforce.com/docs/commerce/commerce-api/references/auth?meta=getPasswordLessAccessToken)` endpoint. This call exchanges the TOTP for an access token.

```sh
curl --location 'https://$CODE.api.commercecloud.salesforce.com/shopper/auth/v1/organizations/$ORG/oauth2/passwordless/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: ••••••' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode "login_id=$LOGIN" \
--data-urlencode 'hint=pwdless_login' \
--data-urlencode 'pwdless_login_token=12345678'
```

The optional `login_id` parameter is used for stronger validation using `login_id` + `pwdless_login_token` (TOTP).

After successful validation of the `pwdless_login_token` (TOTP) or `login_id` + `pwdless_login_token`, SLAS makes a request to create the customer profile in B2C Commerce. The B2C Commerce response includes the new customer profile. Then, SLAS creates the access token (Shopper JWT).
