Generate the Access Token
Generate an access token for customers to use as the bearer token to make requests to the Interaction Service APIs. You must use a signed JSON Web Token (JWT) to generate the access token.
Get the consumer key of the Interaction Service connected app.
- From Setup, in the Quick Find box, enter
App Manager
, and then select App Manager. - From the dropdown list to the right of the connected app you created in Create the Interaction Service Connected App, select View.
- Click Manage Consumer Details.
- Verify your identity with the verification code sent to the email address of your Salesforce account.
- Copy the consumer key.
Using your preferred method, such as JWT.io, generate a signed JWT.
-
For the header, set the
alg
header parameter to theRSA256
hash algorithm. -
For the payload, set these JWT claims:
iss
: The consumer key of the connected app you created.sub
: The username of the Salesforce user account.aud
: The login URL for the Salesforce org.exp
: The expiry date and time for the token, measured in milliseconds since the Unix epoch.
-
For the signature, add the contents of your public and private keys in PEM format, making sure to include the respective headers and footers. You can find the public key in the
server.crt
file and the private key in theserver.key
file.
Use the cURL command to create an access token, where JWT
is the signed JWT you generated, and OAUTH_AUTH_ENDPOINT
with the OAuth authorization endpoint, such as https://login.salesforce.com/services/oauth2/token
.
Instead of using login.salesforce.com, you can also use the My Domain login URL, Experience Cloud site URL, or test.salesforce.com (for logging in to a sandbox) as the hostname in these endpoints. All endpoints require secure HTTP (HTTPS).
The resulting token has the format {orgId}!{token}
. Share this token with your customers to use as the bearer token to make requests to the Interaction Service APIs.
See Also
- Salesforce Help: OAuth Endpoints