Search code examples
asp.net-web-apiodata

Web API call giving "InvalidAuthorizationHeader"


I am trying to connect to an OData API using Advanced REST Client.

The Login is successful and I receive a SecurityToken which I use in the following GET request:

accept: application/json
accept-encoding: gzip, deflate
accept-language: en-US,en;q=0.8
user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36
Content-Type: application/json
authorization: Basic <security-token>

Even though I am using the security token I received from the Login, I am receiving a message that says "The HTTP authorization header is not formatted correctly." and I also receive an "Authorization required" prompt in Advanced REST Client (ARC).

Can anyone tell me what is wrong with the Authorization header or how I can format it correctly?


Solution

  • Something wrong with your token. please show your login result. In addition, My be It is because of authorization type that you use 'basic'. Use 'Bearer' with authorization token: authorization: Bearer ....