Guest Chat API throws unauthorized error

Hi, We are getting an unauthorized error when calling the guest chat api, in certain unexpected scenarios.

headers:
{content-type: 'application/json', content-length: '106', connection: 'close', date: 'Sat, 15 Aug 2020 09:00:20 GMT', inin-correlation-id: 'a619b50a-47a7-480c-a93f-53f7db2ed219'}
Body:
{"message":"You are not authorized to perform the requested action.","code":"not.authorized","status":403}

When calling the following endpoint:

POST:/api/v2/webchat/guest/conversations/{conversationId}/members/{memberId}/messages

in the Guest Chat API: https://developer.mypurecloud.com/api/webchat/guestchat.html

using the following library: 'purecloud-guest-chat-client'

This is only happening intermittently if 2 requests for different customers are serviced by the same pod.

If we construct a new WebChatApi() object for each api call the problem goes away.
Any ideas? We don't want to have to create a new api client each time we make a request to the api. Please let us know what we may be doing wrong

The specific reason for that error was that the JWT used in the request was not valid for that conversation.

I don't know what a pod is, but it sounds like you're conflating sessions/SDK instances/JWTs between your guests. Each guest needs to use the correct JWT for their chat.

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