Genesys Cloud - Developer Community!

 View Only

Sign Up

Expand all | Collapse all

Trying to call the Auth.getTokens command from a webpage hosting the web messenger script but its failing. Please suggest if the syntax is not correct ?

  • 1.  Trying to call the Auth.getTokens command from a webpage hosting the web messenger script but its failing. Please suggest if the syntax is not correct ?

    Posted 10-13-2025 12:03
    Edited by Amit Akela 10-13-2025 15:15


    #Integrations
    #PlatformAPI
    #WebMessaging

    ------------------------------
    Amit Akela
    ------------------------------



  • 2.  RE: Trying to call the Auth.getTokens command from a webpage hosting the web messenger script but its failing. Please suggest if the syntax is not correct ?

    Posted 29 days ago

    Hi Amit,
    Check out this similar example on the Developer Center:
    https://developer.genesys.cloud/commdigital/digital/webmessaging/messengersdk/authenticatedMessenger

    In the example I linked, `AuthProvider.registerCommand` is called outside of the `Auth.subscribe` function call, whereas in your example it is called inside the `Auth.subscribe` function. I think you need to register the 'getTokens' command outside of the 'subscribe' block, then call `AuthProvider.command('getTokens')` in the `Auth.subscribe` callback.



    ------------------------------
    Jacob Shaw
    Sr. Software Engineer
    ------------------------------