Web authenticated messenger is not working

We are integrating Genesys with Forgerock for authenticated web messenger.

Issue is Genesys is not receiving a token to complete the handshake.
Genesys is not getting a token or even ForgeRock creating one for Genesys because there is nothing here working to get that request generated.

I followed Genesys doc and completed below steps.

  1. Create open ID integration
  2. Map it with Messenger deployment

Am I missing something to configure? Do I need to create OAuth to complete this handshaking?

Hi @Shiva_Gupta do you have logic on your page to obtain the initial Authorization Code from Forgerock? That would be the starting point.

Hi @Angelo_Cicchitto

Do we have any doc available to follow?

HI @Angelo_Cicchitto,
Are you talking about auth_url? If yes, we have it.

You will need to add logic on your page to obtain an Authorization Code from ForgeRock. This first step is unrelated to Genesys, it's entirely based on ForgeRock integration. Once you obtain the Authorization Code from ForgeRock, you can then pass it to Genesys.
I see ForgeRock provides this documentation, we support the following OIDC flows:

  • Authorization Code
  • Authorization Code with PKCE

Some vendors also offer JavaScript helper libraries to simplify this first step, something to investigate with ForgeRock directly.

Hi @Angelo_Cicchitto ,

  • Pressing the ‘Test Auth URL’ button gives us a code in the URL we can use with genesys:
  • We used a JavaScript function like this one to hit the genesys API and get a token:

function GetGenesysToken(){

if (window.location.href.indexOf("client_id=Genesys_Client") > -1)

{

var parsedUrl = new URL(window.location.href);

var code = parsedUrl.searchParams.get("code");

var data = JSON.stringify({

"deploymentId": "Provide deploymentid",

"oauth": {

"code": code,

"redirectUri": [redirectUri

}

});

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function() {

if(this.readyState === 4) {

console.log(this.responseText);

}

});

xhr.open("POST", [url);

xhr.setRequestHeader("Content-Type", "application/json");

xhr.send(data);

}

}

GetGenesysToken();

  • Result:
    • {"refreshToken":"token"}

So, what are we missing? We have shown that if we manually push the button and manually run a function on the page we can get back a token from genesys that shows we’re authenticated. But the question is how do we make this all happen automatically and how do we get this token into the widget?

I am looking for guidance on how to apply what we’ve gotten back here to the Genesys widget. Running the code above just gets a token that we can look at but it doesn’t do anything to hand it to the Genesys chat widget to consume.

Hi @Shiva_Gupta,

To pass in the token to Messenger, you will have write AuthProvider plugin - docs. The AuthProvider plugin integrates your brand's login system into Messenger by providing your tokens to our Auth plugin.

Skeleton code for AuthProvider plugin - https://developer.genesys.cloud/commdigital/digital/webmessaging/messengersdk/authenticatedMessenger

Typically during login when the page reloads Messenger code gets initialized and calls your AuthProvider plugin commands to get these details. You can write and put this plugin right after the Genesys deployment script.

As an example, here is the detailed documentation showing how we integrate with OKTA using end point. I suggest to refer to it for understanding purpose only and write your own code in your AuthProvider plugin to pass your tokens to Messenger.

Shiva did you get this working? I have a customer looking to implement ForgeRock as well and they are experiencing 401 issues

ForgeRock issue solved in this post.

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