-4

I am trying to call an API which I have been instructed:

This is expecting an Authorization header: Bearer Access Token.

I have the Bearer Access Token, and have tried via Postman, and via C# using WebRequest, to no avail.

Within Postman I have the method set as GET, Authorization set as No Auth, on the Headers tab I have tried adding one header like so:

Header: "Authorization"
Value: "mytoken"

I have also tried

Header: "Bearer"
Value: "mytoken"

Also

Header: "Authorization"
Value: "Bearer mytoken"

I think maybe it does not work in Postman because of some other headers sent from within PM, but surely from a test C# console application this should work?

What is the right way to give an API the bearer access token? Is the token meant to be encoded?

Camilo Terevinto
  • 31,141
  • 6
  • 88
  • 120
andrewb
  • 2,995
  • 7
  • 54
  • 95
  • You should be already familiar with [How to Ask](https://stackoverflow.com/questions/how-to-ask) and [how to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). Please edit your question accordingly. – wp78de Oct 08 '17 at 22:03
  • Possible duplicate of [JWT Token in POSTMAN Header](https://stackoverflow.com/questions/24709944/jwt-token-in-postman-header) – Camilo Terevinto Oct 08 '17 at 22:10
  • It seems like it would be best to contact the support team of the API to determine what they recommend, assuming it is not you. It looks like you have the header right, but there could be any other number of other factors (wrong port, wrong protocol, wrong URL, missing headers, etc) that is causing your request to fail. – NightOwl888 Oct 08 '17 at 22:10
  • @CamiloTerevinto - Look at the question - the OP already tried that and it didn't work. – NightOwl888 Oct 08 '17 at 22:13
  • May you post the documentation of the API and post your code ? – Youssef13 Oct 09 '17 at 05:25

2 Answers2

0

Try to add this line in your header on Postman:

Authorization: Bearer <token>

It should work...

SamuPert
  • 69
  • 2
  • Mmmh. Ok i know, but the `Authorization` header should be setted with type `Bearer` and then the `token` (that is for credentials) – SamuPert Oct 08 '17 at 22:21
0

Better would be to select "Authorisation" tab and add the Token like below:

Image showing the token being added to the Authorisation section of PostMan

Draken
  • 3,134
  • 13
  • 34
  • 54
A K
  • 76
  • 8