Legacy Dev Forum Posts

 View Only

Sign Up

Embedded client getAuthToken action failing

  • 1.  Embedded client getAuthToken action failing

    Posted 06-05-2025 19:03

    LucasArrudaFernand | 2023-11-21 14:11:28 UTC | #1

    Hi,

    This is very close to this post

    But, by reading it I was not able to make my setup work, so, here I go:

    in my framework.js file I am setting: window.PureCloud.User.getAuthToken((token) => { console.log("TOKEN: " + token); document.cookie = "token=" + token; });

    And in my iframe I have (edited to remove 1st < and last > so that the text shows, otherwise the page do not display the text): iframe id="softphone" allow="camera *; microphone *" src="https://apps.cac1.pure.cloud/crm/embeddableFramework.html?enableFrameworkClientid=true"></iframe

    the clientId is also setup properly in the framework.js file as (id replaced with ""): window.Framework.config.clientIds = { 'cac1.pure.cloud': '***************' }

    But still, I keep having the error "You are not authorized to access the auth token. Auth tokens require the use of a configured clientId"

    my clientId is configured in the uploaded js file (I can see it shows the correct id in the downloaded browser framework.js file), but still, I keep having this error

    Any ideas if this is working anywhere? If yes, any ideas if I am doing something wrong?

    Also, just to confirm, this would allow calling "POST /api/v2/conversations/emails/{conversationId}/messages" with the retrieved auth token as Bearer Token Authentication to send email on behalf of an agent, right?


    ObsTech | 2023-11-20 15:47:31 UTC | #2

    Is your org in the US-East-1 Region?


    LucasArrudaFernand | 2023-11-21 14:55:57 UTC | #3

    Hello, no, it is in the cac1 region, thus I am using:

    window.Framework.config.clientIds = { 'cac1.pure.cloud': '**************' }

    Do you see anything wrong regarding the region?

    PS.: Just sharing, those are the "Authorized redirect URIs (one per line)" set at my oauth client (Token Implicit Grant (Browser)): "https://127.0.0.1 https://apps.cac1.pure.cloud/crm/authWindow.html https://apps.cac1.pure.cloud/crm/index.html https://localhost"

    And all the scopes described here are set: https://help.mypurecloud.com/articles/administrator-requirements-for-the-genesys-cloud-embedded-clients/

    Just tried again to make sure and still keep having error "You are not authorized to access the auth token. Auth tokens require the use of a configured clientId"


    Junji_Sawada | 2023-11-27 14:50:41 UTC | #4

    If you're seeing the error, "You are not authorized to access the auth token. Auth tokens require the use of a configured clientId," it's possible that the iframe URL is missing the optional query string parameter called ?enableFrameworkClientId=true. This query parameter is needed to use your own clientIds to access getAuthToken. Please see https://developer.genesys.cloud/platform/embeddable-framework/deployments/iframe-urls for details.


    LucasArrudaFernand | 2023-11-27 20:59:16 UTC | #5

    Hi, thanks for following up, enableFrameworkClientId=true parameter is set as shown in the line 14 of my initial post here.

    But, I did found that using window.parent.postMessage to post the token works well to expose the user token to the page embedding it, the problem I started seeing now is CORS errors when calling the Platform API /api/v2/conversations/emails/{conversationId}/messages using the user token, I suppose that Genesys is not designed to handle this type of scenario so I advised the client to use Agentless email instead and we are evaluating this possibility since would require to use a new domain.


    system | 2023-12-27 21:00:04 UTC | #6

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


    This post was migrated from the old Developer Forum.

    ref: 23199