---
schema_version: "1"
id: 2b617e8db0f1675dc7e4541bea7a64fbee63d5b17f8cf91f7c0e92903f2a1a71
title: Password Reset with Email
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/commerce-cloud/commerce-api/guides/slas-password-reset-email.md
canonical_url: https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/slas-password-reset-email.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 7f52c8cb6f506c85b7b4dde0d7f23c09ab336b5c9b8682b6c020edd414df65a4
products:
  - Composable Storefront
  - Salesforce APIs
---
# Password Reset with Email

Use the Shopper Login and API Access Service (SLAS) to send a password reset email to a registered shopper. The shopper can then update their password after verifying a one-time password (OTP) contained in the email.

The implementation described in this guide requires no third-party integration. For instructions on password reset using a callback URI instead, see [Password Reset with Callback URI](https://developer.salesforce.com/docs/commerce/commerce-api/guide/slas-password-reset.html).

## Considerations

- Registration: The shopper’s email must be registered with B2C Commerce.
- Volume limits: The monthly quota limit for the `getPasswordResetToken` endpoint with `mode` set to `email` is 1,000 requests per non-production tenant instance. The `getPasswordResetToken` endpoint also has a maximum of 3 requests per user for every 10-minute window.
- SLAS client: Your site must have a SLAS client. Both private and public clients are supported. See [Authorization for Shopper APIs](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/authorization-for-shopper-apis.html).
- DMARC policies: Support is currently limited to email sender domains with relaxed DMARC policies (`p=none`).

## 1\. Add an Email Sender to the SLAS Client

An email sender specifies the sender address that SLAS uses to deliver passwordless login emails, including password reset emails. Use the SLAS Admin UI to add an email sender to an existing SLAS client. Follow the steps to [Add an Email Sender](https://developer.salesforce.com/docs/commerce/commerce-api/guide/slas-passwordless-login-email.html#2-add-an-email-sender) as described in the [Password Login with Email](https://developer.salesforce.com/docs/commerce/commerce-api/guide/slas-passwordless-login-email.html#2-add-an-email-sender) guide.

## 2\. Create a Password Action Template

SLAS uses password action templates to construct the emails used for password resets, as well as [passwordless login](https://developer.salesforce.com/docs/commerce/commerce-api/guide/slas-passwordless-login-email.html#3-configure-email-templates).

To create the password action template for password reset emails, make a PUT request to the [registerPwdlessTemplate](https://developer.salesforce.com/docs/commerce/commerce-api/references/auth-admin?meta=registerPwdlessTemplate) endpoint. Set the `actionType` parameter to `PWD_RESET_ACTION` and the `templateType` parameter to `EMAIL`. Alternatively, the `PWD_RESET_CROSS_DEVICE_ACTION` is used if the `hint` parameter in the `getPasswordResetToken` call is `cross_device`.

In the `link` parameter, use `${token}`, `${name}`, and `${user_id}` substitutions. In the `template` parameter, use the above and the `${link}` substitution.

Emails with OTP that use the SLAS APIs for `getPasswordResetToken` will use this template to send emails to shoppers.

Here’s an example request body for creating a password reset email template:

```json
{
  "channelId": "SiteGenesis",
  "name": "Password Reset Email Template",
  "subject": "Password Reset Token Request",
  "link": "https://store.com/reset-password?token=${token}&email=${user_id}",
  "locale": "en-us",
  "actionType": "PWD_RESET_ACTION",
  "templateType": "EMAIL",
  "template": "Password Reset Request\n\nHello ${name},\n\nYou're receiving this because you requested a password reset for your account.\n${link}\n\nThis link will expire shortly. Do not share it with anyone."
}
```

## 3\. Implement the Password Reset Token Flow

1. Call the [getPasswordResetToken](https://developer.salesforce.com/docs/commerce/commerce-api/references/auth?meta=getPasswordResetToken) endpoint to trigger the email with the OTP. Setting the mode to email instructs SLAS to send the numeric token directly to the shopper's registered email address.
2. Then, call the [resetPassword](https://developer.salesforce.com/docs/commerce/commerce-api/references/auth?meta=resetPassword) endpoint with the shopper’s numeric token to complete the password reset flow.

### SLAS Private Client Example:

1. Request a password reset token

```bash
curl --location 'https://{shortCode}.api.commercecloud.salesforce.com/shopper/auth/v1/organizations/{organizationId}/oauth2/password/reset' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic {base64_client_credentials}' \
--data-urlencode 'user_id=darth.vader' \
--data-urlencode 'mode=email' \
--data-urlencode 'channel_id=SiteGenesis' \
--data-urlencode 'code_challenge=si9PvGgxix3wYge5GrPJO-EPJ9JxLhn6y2_fb8PlUwg'
```

2. After the customer provides the reset token, use it to request a password reset:

```bash
curl --location 'https://{shortCode}.api.commercecloud.salesforce.com/shopper/auth/v1/organizations/{organizationId}/oauth2/password/action' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic {base64_client_credentials}' \
--data-urlencode 'pwd_action_token=12345678' \
--data-urlencode 'user_id=darth.vader' \
--data-urlencode 'new_password=NewSecurePassword123!' \
--data-urlencode 'channel_id=SiteGenesis' \
--data-urlencode 'code_verifier=WyGUskLWv5rRF_-jQdMnKcm48xJzo_CQoMGMKtyQfTh-vhMfPUfGGGesHCP2bQsZ5F07p08QJIJOFlcFAtEMBA'
```

### SLAS Public Client Example

1. Request a password reset token:

```bash
curl --location 'https://{shortCode}.api.commercecloud.salesforce.com/shopper/auth/v1/organizations/{organizationId}/oauth2/password/reset' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=12345678-1234-1234-1234-123456789012' \
--data-urlencode 'user_id=darth.vader' \
--data-urlencode 'mode=email' \
--data-urlencode 'channel_id=SiteGenesis' \
--data-urlencode 'code_challenge=si9PvGgxix3wYge5GrPJO-EPJ9JxLhn6y2_fb8PlUwg'
```

2. After the customer provides the reset token, use it to request a password reset:

```bash
curl --location 'https://{shortCode}.api.commercecloud.salesforce.com/shopper/auth/v1/organizations/{organizationId}/oauth2/password/action' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=12345678-1234-1234-1234-123456789012' \
--data-urlencode 'pwd_action_token=12345678' \
--data-urlencode 'user_id=darth.vader' \
--data-urlencode 'new_password=NewSecurePassword123!' \
--data-urlencode 'channel_id=SiteGenesis' \
--data-urlencode 'code_verifier=WyGUskLWv5rRF_-jQdMnKcm48xJzo_CQoMGMKtyQfTh-vhMfPUfGGGesHCP2bQsZ5F07p08QJIJOFlcFAtEMBA'
```

## Troubleshooting

To diagnose issues with password reset emails, use Log Center. For details, see [Troubleshooting with Log Center](https://developer.salesforce.com/docs/commerce/commerce-api/guide/slas-passwordless-login-email.html#troubleshooting-with-log-center).
