Jump to content
We have recently updated our Privacy Statement, available here ×

Use Auth token to hit the api

Manoj Chaurasia

Recommended Posts

I selected "Basic" authentication when using the Fast Connector Framework Wizard.The call in Postman to get the token had the following properties:

Method = "POST"



Header = (Key = Content-Type, Value = "application/json")


Body = {










This call returns a JSON formatted object containing the token needed to make additional calls to the application.


Please Help, i am stuck

Link to comment
Share on other sites

Hi Joe,


Glad to see your response. I tried and added additional properties email and password and removed the Access Token property.


Now i am trying to test the connection using the email and password, the connection established and shown a success message. This was working fine as earlier.

Now in my Rest Api when we are using email and password and hit a token url, i am getting a api token and in my next call when i am trying to fetch the record like users or tiles list i need to send this token in header like "Bearer" + token


I tried with below code but i am getting Authorization error


protected override Func ConnectionConfiguration()


string LoginUrl = "


token = "Bearer " + rA.token;

return "Bearer " + rA.token;



.ConnectionInfoToBaseUrl(info => info.BaseUrl)



return myToken;


protected override IList ConfigureQueries()


var tiles = this.Queries.EnumerateResponseAs("/api/v1/tiles", r => r).ToHeader("Authorization", this.token);

var tasks = this.Queries.EnumerateResponseAs("/api/v1/tasks", r => r);

var users = this.Queries.EnumerateResponseAs("/api/v1/users", r => r);

return new List { tiles, tasks, users };


Link to comment
Share on other sites

Are you able to use PostMan to successfully retrieve Tiles, Tasks or Users

If so, I would capture a Fiddler trace while attempting to retrieve the records.


After that, I would compare the successful request (from PostMan) to the one made using the Fast Connector Integration Framework.


That should give you an idea to what changes should be made.

Link to comment
Share on other sites

Hey Rafael,


Yes, I am able to retrieve the records using Postman. In Postman first i use to retrieve the token by url https://dev.practicepipeline.com/api/jwt-auth/v1/token

with username: KiwiTech and password:k1W1t3C#


Then using that token in header Authorization: "Bearer " + token and url

https://dev.practicepipeline.com/api/tiles with get method we can retrieve tiles.


you can try at your end using postman and let me know if needed any help.

Link to comment
Share on other sites

Hi Rafael,


Actually we are unable to the request created by Fast Connector Framework. We are just getting message "HTTP response code was 401" with other details. Please see the image below for your reference.




We are also attaching the postman request/response screenshots for your reference. What we are doing here. First we are generating the token using username and password and after that we are using that generated token in header of other request to get the tiles. Please the images below.






I think it will be best if can do a screen share to resolve this issue. We are unable to debug the issue so it will be helpful you guys can guide us over the screen share.

Link to comment
Share on other sites

This took a little digging, but turned out to ultimately be pretty easy. First, the short answer is to map the query like this:






...and not try to map the header.


I simplified the Connection registration:






That code takes the response and creates a header named "Authorization" with the value rA=>"Bearer"+rA.token

that will be used on every call. The context here is just the standard headers that the http client is initialized with.


That should get you the header that you want on the query call. But that will get you to your next problem. The Tile type has an array of Tasks -- the FCF predates hierarchical data, so that will not work, and having it in there will result in an infinite recursive call that will get you a out of memory error.


To fix that, comment out properties that are arrays. It would also be a good idea to make all of the properties not object (to me it looked like either strings or bools).


Additionally, I can offer a little bit more information. If you use the ToHeader("Authorization", this.token), it will use the value at initialization. So, for example, if I changed the token declaration to:




publicstringtoken = "initialized value";


The header will be set to "initialized value".


If you ever want to play around with some difficult code, the framework that is designed for human consumption is built on some less straightforward building blocks, and you can map using those. I do not recommend it, but I was able to get the following to work:


















This would also require the previous connection registration where the token is set as part of the FromResponseToContext().


Again, I do not recommend it as it would probably be easier to create a connector using the standard CDK, than to use this. If you are almost all the way there, it might help with something.

Link to comment
Share on other sites

  • Create New...