Setup using Client Credentials Flow
Configure a Connected App for the OAuth 2.0 Client Credentials Flow
- Create Connected App
- In Setup, go tp App Manager (Apps-> App Manager)
- Click the "New Connected App" button
- Fill out the required fields in the "Basic Information" section
- Under the API section, enable the setting "Enable OAuth Settings"
- In the "Callback URL" field, enter http://localhost
- In "Selected OAuth Scopes", selection the following options:
- "Manage user data via APIs (api)"
- "Perform requests at any time (refresh_token, offline_access)"
- Check the "Enable Client Credentials Flow" checkbox
- Click "Save"
- On the next page under the API section, click "Manage Consumer Details", submit the verification code (if necessary), and then copy "Consumer Key" and "Consumer Secret" into a note. These keys will be used during the authentication process outlined in the next section.
- Go to Setup->Apps->Connect Apps-> Manage Connected Apps
- Click "Edit" next to the Connected App label
- Under "Client Credentials Flow", set the "Run As" User.
- Ideally this is an Integration Only User, but an Admin User is fine for testing purposes.
- Click "Save" to update the Connected App
- Obtain the My Domain URL value
- In Setup, go to My Domain (Company Settings -> My Domain)
- Copy the value of "Current My Domain URL". This will be used for the authentication callout
Authentication
OAuth 2.0 Client Credentials Flow for Server-to-Server Integration
Endpoint
https://{{My Domain URL}}/services/oauth2/token
| Parameter | Description |
| grant_type | Set to "Client_credentials" |
| client_id | "Consumer Key" from Connected App |
| client_secret | "Consumer Secret" from Connected App |
Sample Request
Sample Response
{
"access_token": "00DDS000001LIKy!AQwAQGi.FPsa8yRtlbGgBMKyq8fdpI5t_gZe3WPLWP3ra0ks64gOkvyJBmGEkkkjRdRLF70jVA9cOctrh9AvSTwilAzxTL",
"signature": "DuFgfn+VH7YnLV70FLFnZ5+ErbZ+krzNaEUKdLWUtZY=",
"scope": "api",
"instance_url": "https://customization-inspiratio-5f-dev-ed.scratch.my.salesforce.com",
"id": "https://test.salesforce.com/id/00DDS000001LIKy2AO/005DS00000wJSB4YAO",
"token_type": "Bearer",
"issued_at": "1696869682710"
}
Notes
Use the "instance_url" property from the authentication callout response as the base URL for callouts to our custom REST APIs, including eLead endpoints.
Comments
0 comments
Please sign in to leave a comment.