Hello everyone,
I need to call a REST API with a Bearer token passed in header of the request (Authorization header).
How can I configure my rest service isntance to have the bearer parameter filled by K2 ?
Thanks for the help,
Regards,
Pierre
Hello everyone,
I need to call a REST API with a Bearer token passed in header of the request (Authorization header).
How can I configure my rest service isntance to have the bearer parameter filled by K2 ?
Thanks for the help,
Regards,
Pierre
Hi Pierre
I got it working this way.
The service instance property should be as this.
In the Default HTTP Header prop, look for the “INSERT TOKEN HERE!” text. You should replace that, with your bearer token.
I hope this will help you :)
Authorization Header Format: Bearer {0}
Default HTTP Request Headers
{"$type":"SourceCode.SmartObjects.Services.Endpoints.Common.HttpHeadera], SourceCode.SmartObjects.Services.Endpoints.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null","$values":e{"$type":"SourceCode.SmartObjects.Services.Endpoints.Common.HttpHeader, SourceCode.SmartObjects.Services.Endpoints.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null","Name":"Authorization","Value":"INSERT TOKEN HERE!"},{"$type":"SourceCode.SmartObjects.Services.Endpoints.Common.HttpHeader, SourceCode.SmartObjects.Services.Endpoints.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null","Name":"accept","Value":"application/json"},{"$type":"SourceCode.SmartObjects.Services.Endpoints.Common.HttpHeader, SourceCode.SmartObjects.Services.Endpoints.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null","Name":"Content-Type","Value":"application/json"}]}
Hi Bjarke,
Thanks for your help, I tested it like that and it works.
Now I’m trying to send the token of my connected user, because third party tool check the expiration date of the token, so I need to get a fresh token to communicate with my web service.
Did you found any solution on your side ?
Thanks !
Hi Pierre
Sorry, i cant help you with that part.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.