About Agent Tokens

A typical chat agent app in Oracle B2C Service leverages the functionality of the various REST API operations documented in this guide. To initiate an agent session, you first need to use agentTokens, a REST endpoint in Oracle B2C Service to fetch the JSON Web Token (JWT) that is needed for authentication. Let's walk through the operational flow:

  1. The chat agent app makes a POST REST request to the Oracle B2C Service agentTokens endpoint using Basic authentication. Basic authentication requires the username and password defined in the CX configuration for the agent attempting to authenticate.
  2. agentTokens generates a JWT and returns it back to the chat agent app.
  3. The chat agent app then uses the JWT received from the agentTokens response to set the Authorization header field in the subsequent CreateAutomatedAgentSession call to establish a session on the chat server.

Here's the URI for the agentTokens endpoint in Oracle B2C Service:

/services/rest/crossChannelServices/latest/agentTokens

Supported Attributes

There are no supported attributes that can be specified in the agentTokens request body. Only an empty body is permitted.

Supported Request Headers

The required request headers for the agentTokens call are:

  • Authorization - This HTTP header is used to specify the Basic authentication credentials for the request.
  • Host - This HTTP header is used to specify the host of the site.
  • OSvC-CREST-Application-Context - This HTTP header is used to add comments to REST API requests in Oracle B2C Service. The Application Context information can be viewed from the PAPI Meters Debug Log report. This report is available in the Reports Explorer at \Public Reports\Common\Site Administration\Public API. The maximum text length is 40 characters. If you provide more than 40 characters, then a Bad-Request error occurs.

Sample Payloads

Here's an example of the REST response body for the agentTokens call:

{
"sessionToken": "eyJhbGciOiJSUzI1NiIsInR5cCI...RwEc14B6BBn1M_xVCEfPgw",
"links": [
     {
          "rel": "describedby",
          "href": "http://sitename.host/services/rest/crossChannelServices/v1.4/metadata-catalog/agentTokens",
          "mediaType": "application/schema+json"
     }
         ]
}