Headless Login JavaScript Examples
Headless Registration JavaScript Examples
Headless Forgot Password JavaScript Examples
Building a Native Single Sign-On Experience JavaScript Examples
Getting User Info JavaScript Examples
Previous Versions
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.
| Required Editions |
|---|
| 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 Forgot Password Flow—You can use this resource for public and private clients.
Headless Login JavaScript Examples
Use these high-level examples to understand how to implement headless login for a single-page app.
Headless Registration JavaScript Examples
Use these high-level examples to understand how to implement headless registration for a single-page app.
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.
Building a Native Single Sign-On Experience JavaScript Examples
Use these high-level examples to understand how to create a native single sign-on (SSO) experience for a single-page app. This configuration uses a redirect-based flow to make it seem like your app natively integrates with an SSO provider. It isn’t technically headless, but the user experience is the same as the headless flows.
Getting User Info JavaScript Examples
When you get an access token via headless registration or headless login, you can retrieve user information with a request to the User Info endpoint. Use this example to understand how.