Data Action with custom authentication not working

Hi, we are currently integrating with a Dynamics environment, where we want to pull some data from the system. There is no need for a screen pop, just show some fields to the agents using Scripter.

I have added the Data Action and did a custom authentication, when testing this authentication I get all lights green.

image

As I understand I can now use the values:

  • authResponse. token_type
  • authResponse. access_token

In my Authorization header:

But when I then test the Data Action I get this result:

So there is something in the header, but the Data Action says no.

When testing this with Postman, I first use a request to catch the bearerToken, save this as an environment variable. And then do a second request where that environment variable is set in the the Authorization header.

And when I use it like that I have a 200 OK and some results in JSON.

Am I doing something wrong here?
Thanks,
BR, Rob

Hi Rob,

I don't know if it was Dynamics, but there was at least one web service where they would return the token_type with a specific casing, like "bearer" but they would only accept a different casing, like "Bearer". Might check that. I see that you already have Transfer-Encoding set to buffered, which does resolve a lot of weird problems. If you still can't get it to work you might have to try something more extreme like https://developer.genesys.cloud/blog/2022-03-22-troubleshooting-data-actions/ to see what is going wrong.

--Jason

Strange thing is, that if I paste the bearer and token direct in the configuration the request goes on, so someting with the translation of the values seems to be not OK I guess.

Hi Jason,

I think I found something.
When I take the token from Postman and paste it into the request the request works.
If I check if the variable ${authResponse.access_token} gets filled with a value from the custom authentication it seems to work. But when I compare the tokens the one that I get in Genesys is shorter.
The shorter one doesn't work when I paste it directly into the request, so because I am missing some characters the request fails.

Now the question is, is there a length limit in the custom authentication request that I might bump into?

Postman request = 1324 char.
eyJ0eXAiOiJKV1QiLCJhbGci ... CFWcDiVc-pH5Mvf2Wbc3mfQizsEk_FPHBwjQ

Genesys Cloud request = 1287 char.
eyJ0eXAiOiJKV1QiLCJhbGci ... RAiktbgfStzXt-Q

BR,
Rob

It appears that the authentication information is in the form of a JWT. Putting the two authentication examples into a base64 decoder there are differences between the two examples you provided
Working
"aud":"https://redacted.com"
"roles":["Connector.FullAccess"]

Not working
"aud":"00000002-0000-0000-c000-000000000000"
roles not present

--Jason

Hi Jason,
If it is JWT can it still work, or do we need another form of integration?

BR,
Rob

Hi Rob,

Based on your results so far it seems like it should be possible to get this to work. The problem appears to be that the JWT that is being created by the request from postman is different than the JWT created by the data action authentication action, indicating that they are making subtly different requests. You might look at the console in postman to see exactly what is being sent during authentication and compare it to the results of testing the authentication action in test mode, or the more extreme approach of running your data action through a proxy to see what is going on.

--Jason

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