How to send access token for rest api authentication

Can anyone suggest me how to send the bearer token to get all users.

When login is successfull, I am returning accessToken as response. How to send that accessToken as authentication header to "Get" Api.


Hi Jahanvi,

In your case instead of setting Authorization header in the REST API property you can pass it while calling this API action. For that yu have to add Authorization Header in your API method (see below image for reference).

After you add this header here it will be available as a input parameter while calling this API method and you can pass the response you have received from previous login API call


Nikhil Gaur wrote:

Hi Jahanvi,

In your case instead of setting Authorization header in the REST API property you can pass it while calling this API action. For that yu have to add Authorization Header in your API method (see below image for reference).

After you add this header here it will be available as a input parameter while calling this API method and you can pass the response you have received from previous login API call



Hi Nikhil, 

As I am new to this outSystems, Can you explain me how to pass the response received from previous login API call .



Hi Jahnavi,

You just need to append the token value with string: "Bearer"+tokenvalue(your variable or string value of token)

Please refer the below screenshot for reference:

Hope this helps.

Regards,

Manish Jawla

Manish Jawla wrote:

Hi Jahnavi,

You just need to append the token value with string: "Bearer"+tokenvalue(your variable or string value of token)

Please refer the below screenshot for reference:

Hope this helps.

Regards,

Manish Jawla

I have understood your point, but my doubt is how to send tokenvalue dynamically from login response to getAllUsers api


Hi Jahnavi,


If I understood correctly, your scenario is something like this:

  1. You need to get a bearer token,
  2. You need to provide the token from #1 to GetAllUsers endpoint.


If that is your case you first need to call the API that issues the bearer token, and the use it while getting all users.