Overview

The (Delegation) Get Token API provides brands with the ability to retrieve their authenticated consumer's OAuth 2.0 tokens (id_token & access_token).
This API can be used mainly for integration of bots implemented by the Messaging Agent SDK bots with brand's internal APIs.

Prerequisites

A few things you’ll need to get started with this API:

  1. Retrieve your domain. Use the LivePerson Domain API to retrieve this information by providing the following service name: idp

  2. OAuth 2.0 Client Credentials flow - This API requires authorization using a machine-to-machine authorization. follow the instructions, to register an OAuth 2.0 application and generate a JWT access token (Using version 2 of the Authorization API).

    When registering an OAuth 2.0 application for using the Users API, use the “delegated.token.read.external” scope.

Request

Method URL
GET https://{domain}/api/account/{accountId}/consumer/{consumerId}/brand/tokens

Request Headers

Header Description
Authorization A dedicated bearer token string to allow request authorization.

Path Parameters

Parameter Description Type Required Notes
domain Consumer IDP hostname String Required  
accountId LivePerson site ID String Required  
consumerId LivePerson formated participantId String Required  

Response

Response Codes

Code Response
200 DelegatedAccessTokensDto with the access token and ID token
400 Validation error, consumer id missing or not valid
404 Tokens not found for this account
500 Internal server error

Notes:

The use of this API for consuming tokens (access_token & id_token) is depends on a dedicated feature activation (tbd), and for the brand to delegate these tokens during consumer's authentication flow with LivePerson.

Response Example:

{
    "accessToken": "eydhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIiwiaXNzIjoiaHR0cHM6Ly95YW5pdmIuYXV0aDAuY29tLyJ9..q4WfRsU3x7UWnfub.E_39lvh4j7DZ4XPR0Sq0s-NZLkTtYfuSLHEi_rgAmDxxGNBED99vxtCM-tpPEJTLBMnbIG13e17wAgLIFQOG_I33K3SJVqO1jDmj8EfA22a_lna9fu8PSdXXlCicXMEEv17uYdTs_MWzHW6bKp3YWVDYaG08JyhsDGVbtVIilze2Ib9HXLiXX6WnctPSidFBG6Eh8IYb2jmXlh2gWPU5p4vrz6F4-QcXtShA95i67Lv_RQV-_cCcsv-v1AfY5LIkFAo0DgJGHu5ZcBG66-APybw8rtFm8gE.q52ZBCyNtrvnQvqSfJP28g",
    "idToken": "eyJhbGciOiJS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