Post conversations using Secureivrsessions

I am trying to use

POST /api/v2/conversations/{conversationId}/participants/{participantId}/secureivrsessions

to transger a caller into a diferrent flow. I am get the sourceParticipantId, participantId and userData using

GET /api/v2/analytics/conversations/details?id={conversationId}

and my request is like this:

await axios.post(
        `https://api.mypurecloud.com/api/v2/conversations/${callUUID}/participants/${this.participantId}/secureivrsessions`,
        {
          participantId: this.participantId,
          sourceParticipantId: this.sourceParticipantId,
          flowId: this.flowId,
          userData: this.queueId,
          disconnect: true,
        },
        {
          headers: {
            Authorization: `Bearer ${this.token}`,
            "Content-Type": "application/json",
          },
        }
      );

I get the following error:

This request requires a user context. Client credentials cannot be used for requests to this resource

Hello,

I am not sure what the question is.
The error describes what the issue is - you cannot use a token obtained via an OAuth Client Credentials Grant flow to invoke this API Endpoint.
You need to use an auth/bearer token, related to a user context (the user connected to this call) using an OAuth Implicit Grant flow, or an Authorization Code/PKCE Code/Saml2Bearer grant flow.

Regards,

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.