Legacy Dev Forum Posts

 View Only

Sign Up

Guest Chat API throws unauthorized error

  • 1.  Guest Chat API throws unauthorized error

    Posted 06-05-2025 19:21

    msgm | 2020-08-17 02:44:18 UTC | #1

    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


    tim.smith | 2020-08-18 15:00:37 UTC | #2

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

    msgm, post:1, topic:8583
    This is only happening intermittently if 2 requests for different customers are serviced by the same pod.

    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.


    system | 2020-09-18 15:00:42 UTC | #3

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


    This post was migrated from the old Developer Forum.

    ref: 8583