JavaScript Examples for Headless Identity APIs
Postman is great for testing and learning how to set up headless identity flows, but it
doesn’t show you how your app can interact with Headless Identity APIs. Use these high-level
JavaScript examples to understand how your app can call these APIs in a real-world
implementation. Like the rest of this guide, the examples here apply to single-page apps, also
known as public clients. These examples don’t show you how to use these flows with client-server
apps or private clients.
Available in: both Salesforce Classic (not available in all orgs) and Lightning Experience |
Available in: Enterprise, Unlimited, and Developer Editions |
These examples are for demonstration only and aren’t meant to be used in production. Always test code before deploying it to a production environment.
Unlike the Postman examples, these examples use the Proof Key for Code Exchange (PKCE) extension, which improves security. We strongly recommend that you always use PKCE when configuring these flows with public clients.
The examples present a simplified overview of each headless flow for public clients. For in-depth descriptions of the flows for both public and private clients, see these resources in Salesforce Help.
- Headless Identity APIs for Customers and Partners
- Authorization Code and Credentials Flow for Public Clients
- Authorization Code and Credentials Flow for Private Clients
- Headless Registration Flow for Public Clients
- Headless Registration Flow for Private Clients
- Headless Forgot Password Flow—You can use this resource for public and private clients.