Headless Forgot Password JavaScript Examples

Use these high-level examples to understand how to implement the Headless Forgot Password Flow for a single-page app.

The Headless Forgot Password Flow contains two requests to the same endpoint. You initialize the flow with a request to Headless Forgot Password API. Here’s a function that you can call to initialize the password reset.

This request results in Salesforce sending the user a one-time password (OTP).

For the second request, you pass the username, new password, and OTP to Headless Forgot Password API. Here’s a function that you can call to complete the password change.

Because both requests call the same endpoint, you can use one function for both calls.