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="Genesys Cloud Embeddable Framework"></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?
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"
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.
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.