Issue with $Auth merge variables

  • 1
  • Problem
  • Updated 4 months ago
  • In Progress
Hello

I am trying to set up an external data source from Pardot using the REST Api. For every request, Pardot's REST service requires a user key that will be hard coded on a user's record and an API key that comes as a response to a successful authorization. Both are supposed to be in the header of a GET request.

I was able to set up the authorization part of the data source correctly. When I inspect the model I have on a test page it's showing the authorization request configured correctly and it's returning a valid API key. When I look at the responseBody section the field is showing as api_key.

I'm getting an issue when I try using the authorization merge variable in the common request header. Per the skuid documentation I believe the merge variable should look like this: {{$Auth.Response.Body.api_key}}. However, when I inspect the request on my test page, it's just showing that merge template and not the actual API key that was returned. 

When I hardcode an API key I get from doing the request in Postman or something it is sending the request correctly. I just can't figure out how to get the key in there dynamically. 

I'm also having trouble getting the actual data in the fields to show up when the request is set successfully, but that's probably another question.

Thanks!
Photo of Joe Dobbels

Joe Dobbels

  • 596 Points 500 badge 2x thumb

Posted 7 months ago

  • 1
Photo of Josh Chandler

Josh Chandler, Employee

  • 60 Points
Hi Joe,

In the configuration where exactly are you putting the $Auth merge variable?  Is it in the request headers of the Authentication Provider or is it part of the request headers of the Data Source?  Typically it will go in the Authentication Provider configuration.  The merge variable looks correct, and it should be getting merged even if the api_key doesn't exist in it.  If the case that it doesn't exist, then it should be replaced with an empty string, and the merge syntax shouldn't be sent in the request.  The fact that the merge variable still exists as the header value of the request, makes me think where the merge variable is declared, might not be in the correct place.