call web api with bearer token


Hi.

based on the following link http://community.k2.com/t5/K2-blackpearl/How-toHandle-Authorization-Token-while-Creating-Endpoints-REST/td-p/101490/page/2 I found  solution to call a web api authorized method by passing the token in the HTTP Header. however, this is a static token, while any token will expire after a while.

how to handle the expiry of the token and get a new token?

I appreciate if there is any solution, documentation or any help for that.


2 replies

OmarMallat,

 

When an access token is about to expire or has already expired, a refresh token is used to create a new access token.
However please follow the link below based on Tokens:

 


 

Please NOTE: K2 will not accept any liability for any issues arising from actions taken in respect of the information provided by any forum member.

 

Hi Sello,

 

I met the same problem with OmarMallat, I have a rest api which need bring bearer token in headers, the token will expire every hour, and the token is  dynamic, it gets from another api.

Below is my situation:

Everytime I call the api, I will call client_credentials API first to get bearer token, then using the token which just get by passing the API.

 

My question is how to assign these dynamic bearer token to the header when I calling the API? Are there any samples or tips?

Thanks in advance!!

Reply