Access Platform API inside a Client App embedded in apps.mypurecloud.com website

Hi,

I am trying to build an integration page inside the genesys interface. That works fine but now I would like to access some resources from the platform api. That works also fine BUT I do need to login to get an access token. That seems a little strange as the user has already logged in into the Genesys interface.

Is it possible to get the access token from the current logged in user? I see that it is stored in the local storage but since integration pages are shown in an iFrame I can't reach that from my page...

Any help or advice would be appreciated!

Best Regards,

Peter

Hi Peter,

That's a limitation stemming from the fact that embedded apps are separate applications accessed using an iFrame.
I don't know of any solutions off hand but it wouldn't hurt to use the Ideas Portal to raise the issue so people can consider an alternative for embedded apps.

If you use a "Token Implicit Grant (Browser)" oauth client, you should be able to get a token if the user is already logged into the Genesys UI without logging in again. I would leverage the SDK if possible to minimize the coding involved to handle Oauth flows. Give that a shot and let us know if it works!

Implicit Grant Documentation

SDK Setup

If you need direct access to the token from the SDK, you can grab it like this. This is for javascript but you can adapt it to your language of choice.

image

1 Like

Shane! You are my hero! This works! Thank you sooooooooooooooooooooo much!

First it didnt, but i forgot that my tenant is in europe so I had to add:

client.setEnvironment("mypurecloud.de");

1 Like

Great news, glad to help!

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