Configure Experience Cloud Settings for Headless Passwordless Login
Before you build the Headless Passwordless Login Flow, configure these settings for security and access.
Required Editions
| Available in: both Salesforce Classic (not available in all orgs) and Lightning Experience |
| Available in: Enterprise, Unlimited, and Developer Editions |
Before configuring these settings, complete these steps.
For security, you must configure Salesforce to require either authentication or reCAPTCHA for your app’s initial request to Headless Passwordless Login API. Your security best practices depend on whether your app is a private client or a public client.
If you’re implementing the flow with a private client, like a traditional client-server app
with its own private backend, we recommend that you always require authentication. With this
requirement, when your app submits information to the headless passwordless login endpoint,
you must include an access token. To get the access token, use an internal integration user
to complete an OAuth flow integrated with Salesforce, like the OAuth 2.0 web server flow.
Include the pwdless_login_api scope when you complete
this flow, either by configuring it in your connected app or passing it as a parameter.
For a public client that can’t securely store information, like a single-page app, we recommend that you always require reCAPTCHA. With this requirement, you must include a reCAPTCHA token in POST requests when your app submits user information to Headless Passwordless Login API. To get a reCAPTCHA token, implement reCAPTCHA on your third-party app. For more information, see the reCAPTCHA documentation provided by Google. Salesforce supports these reCAPTCHA versions: v2, v3, and Enterprise.
For a public client, we never recommend requiring authentication because the app can’t keep the access token secure.
To expand your email template options for the one-time password (OTP) email sent to end users during the flow, opt in to email template allowlisting and create an allowlist with custom templates. See Use Multiple Email Templates for Headless Flows.
- From Setup, in the Quick Find box, enter Sites, and then select All Sites.
- To access Experience Workspaces, next to your site name, click Workspaces.
- Select Administration, and then select Login & Registration.
- From the Administration workspace, select Login & Registration.
- Under Headless Passwordless Login, select Allow login via the Headless Passwordless Login API.
- To require an access token when your app submits information to Headless Passwordless Login API, select Require authentication to access this API.
- To require a reCAPTCHA token when your app submits user information to Headless Passwordless Login API, select Require reCAPTCHA to access this API.
- If you selected Require reCAPTCHA to access this API, configure
reCAPTCHA settings.
- For Secret Key, enter the key from your reCAPTCHA API key pair.
- For Score Threshold, enter a threshold value between 0.5 and 1.If you’re using reCAPTCHA v3, this value determines the score that you accept. Scores closer to 0.5 are more likely to be bots, while scores closer to 1 are more likely to be valid users. For more information, see the reCAPTCHA v3 documentation.
Note If you require reCAPTCHA for other Headless Identity flows, like registration and forgot password, these settings also apply. - To use a headless user discovery handler to look up users, take these steps.
- For User Discovery Handler, click
and select an Apex class that implements the Auth.HeadlessUserDiscoveryHandlerinterface. Or, to generate a template class, click Create a headless user discovery handler template and customize the code later. - For Run As, select a user to run the handler. We recommend that you use an integration user account instead of a real user.
- For User Discovery Handler, click
- Save your settings.
- Optionally, customize the OTP email that’s sent to end users for verification. If you
created an email template allowlist, Salesforce defaults to this email template if you
don’t include an
emailtemplateparameter in your request.- From the Administration workspace, select Emails.
- For One-Time Password, click
. - In the window that appears, select Experience Cloud: One-Time Password Email.
- Save your changes.
- To customize the email, edit its default content.
You’re now ready to implement the Headless Passwordless Login Flow. Check out the instructions for your app type.

