The TIBCO Platform is a real-time, composable data platform that will bring together an evolving set of your TIBCO solutions - and it's available now!
A chart showing the TIBCO Platform vision
Jump to content
Forums
Ask questions and gain insight from discussions

Recommended Posts

Posted

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"

 

URL=https://jwt-auth/v1/token

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

 

Body = {

 

"email":"XXXX",

 

"password":"ZZZZ"

 

}

 

 

 

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

 

Please Help, i am stuck

Posted

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)

.End();

 

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 };

}

Posted

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.

Posted

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.

Posted

Hi,

 

I am still waiting for response, Can we please expect reply soon from you guys, We are getting very slow response from support team. I am stuck at some point. Is there any other way to connect you guys with screen sharing

 

Please reply

Posted

If you are able to compare the request generated using PostMan to the one generated using the Fast Connector Integration Framework.

 

Are you able to find any differences

 

The differences could give us a hint to how we should modify the way that we are putting together the request.

Posted

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.

Posted

Hi Prashant,

 

Sorry for the delay on this, but I would like to arrange for someone on our team to assist you in a web session. Can you provide a time that would work for you during the 9:00AM-5:00PM EST timeframe

 

Thanks,

Joe

Posted
Let's schedule for 10:00 AM EST please. There's a time difference here so this thread will be a continuous back and forth until something is scheduled. Let's assume that Prashant & KiwiTech team will be available and ready at 10:00am EST.
Posted

Dave & Prashant, I sent you an email invite to a zoom meeting 10:00 EST. Please let me know if you didn't receive it or if you can't make the meeting.

Thanks,

Joe

Posted

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

 

Snippet:

 

vartiles=this.Queries.EnumerateResponseAs("/api/v1/tiles",r=>r);

 

...and not try to map the header.

 

I simplified the Connection registration:

 

Snippet:

 

.FromResponseToContext("Authorization",rA=>"Bearer"+rA.token)

 

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:

 

Snippet:

 

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:

 

Snippet

 

publicKeyValuePairAuthMap(IReadOnlyDictionaryd,HttpContextcontext)

{

returnnewKeyValuePair("Authorization",this.token);

}

varempty=Enumerable.Empty();

varconnectionFormNameTypes=empty;

varcontextNameTypes=new[]{newKeyValuePair("auth",typeof(string))};

varinputNameTypes=empty;

varsources=newStringToStringMappingSources(connectionFormNameTypes,contextNameTypes,inputNameTypes);

Funcfmap=AuthMap;

varmapping=newStringToStringMapping(sources,fmap);

 

vartiles=this.Queries.EnumerateResponseAs("/api/v1/tiles",r=>r).WithHeaderMapping(mapping);

 

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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...