Use the OAuth 2.0 echo endpoint to simplify development when you configure the
Authorization Code and Credentials Flow for public clients, such as single-page apps. You can
also use this endpoint for variations of the Authorization Code and Credentials Flow, including
headless registration, passwordless login, and guest user flows.
Required Editions
| Available in: both Salesforce Classic (not available in all orgs) and Lightning
Experience |
| Available in: Enterprise, Unlimited, and Developer
Editions |
The echo endpoint is available for Experience Cloud sites at
https://MyExperienceCloudSite.my.site.com/services/oauth2/echo, where
https://MyExperienceCloudSite.my.site.com is your Experience Cloud domain.
This endpoint supports Cross-Origin Resource Sharing (CORS).
During the Authorization Code and Credentials Flow, Salesforce returns a 302 redirect to a
preconfigured URL that contains the authorization code, along with other parameters. The
/services/oauth2/echo endpoint makes it easy for you to get the code by
returning these URL parameters in JSON format. In the next step of the flow, you exchange the
code for an access token. Use this endpoint for use cases where you want to complete the entire
headless login process, including the token exchange.
To use this endpoint, when you set up your external client app, configure
https://MyExperienceCloudSite.my.site.com/services/oauth2/echo as your
callback URL, which you use as the redirect_uri value when you set up the
flow.
Here’s an example URL that the endpoint accepts as an input.
https://MyExperienceCloudSite.my.site.com/services/oauth2/echo?code=aPrxr*******%3D%3D&state=mystate&sfdc_community_url=https%3A%2F%2FMyExperienceCloudSite.my.site.com%&sfdc_community_id=0DBRXXXXXXXXX
And here’s an example response based on that input.
{"code":"aPrxr*******","sfdc_community_url":"https://MyExperienceCloudSite.my.site.com","sfdc_community_id":"0DBRXXXXXXXXX","state":"mystate"}