Generates an access token. Use the access token as a bearer token to make requests to the Messaging for In-App and Web APIs.
Operation ID: generateAccessTokenForAuthenticatedUsercurl "https://{scrt-url}/iamessage/api/v2/authorization/authenticated/access-token" \
-X POST \
-H "content-type: application/json" \
-d '{
"orgId": "00Dxx0000000xxx",
"esDeveloperName": "myDeployment",
"capabilitiesVersion": "1",
"platform": "Web",
"deviceId": "b8c06d01-b410-4097-bd8a-03cc71862d24",
"context": {
"appName": "salesApp",
"clientVersion": "1.2.3"
},
"authorizationType": "JWT",
"customerIdentityToken": ""
}'
In the URI, set {scrt-url}
to the URL in the Messaging for In-App and Web custom client Embedded Service deployment code snippet. For example, https://mycompanyname.salesforce-scrt.com
.
{
"orgId": "00Dxx0000000xxx",
"esDeveloperName": "myDeployment",
"capabilitiesVersion": "1",
"platform": "Web",
"deviceId": "b8c06d01-b410-4097-bd8a-03cc71862d24",
"context": {
"appName": "salesApp",
"clientVersion": "1.2.3"
},
"authorizationType": "JWT",
"customerIdentityToken": ""
}
Properties inherited from BaseAuthorizationRequest.
The 15-character org ID of the Salesforce org where Messaging for In-App and Web is set up.
00Dxx0000000xxx
The API name of the Messaging for In-App and Web Embedded Service deployment. The name can contain alphanumeric characters and underscores, and must begin with a letter.
Verify that the Embedded Service deployment is configured to support the request.
- The deployment type for the Embedded Service deployment must be set to Custom Client. If properly configured, after you send the request, deploymentType
in the response will be set to api
. If deploymentType
isn't set to api
, create an Embedded Service deployment or use another deployment with deployment type set to Custom Client. See Configure a Custom Client Deployment for Messaging for In-App and Web for more information.
- If you're generating an access token for an authenticated user, the Messaging channel that’s associated with the Embedded Service deployment must have User Verification turned on. If you're generating an access token for an unauthenticated user, the Messaging channel that’s associated with the Embedded Service deployment must have User Verification turned off. See Set Up User Verification for more information.
myDeployment
1
Specifies whether the Embedded Service deployment (esDeveloperName) is used for a mobile or web application. Possible values are: “Mobile” and “Web”.
- Web
- Mobile
Web
b8c06d01-b410-4097-bd8a-03cc71862d24
The request context object. Required for web apps.
Properties defined inline.
The authorization type used to interact with the Messaging for In-App and Web APIs. Set this value to JWT. This field is required.
- JWT