kbd
kbd

Reputation: 4449

API call with correct access token in header gives me a 401 unauthorized

I'm requesting a token against an identity server app, that we used on a previous project, for the current project. On my local machine, so localhost level.

The token request works:

IdentityServer3.Core.ResponseHandling.TokenResponseGeneratorCreating token response
IdentityServer3.Core.ResponseHandling.TokenResponseGeneratorProcessing token request
Identity.Api.Monitoring.IdentityEventServiceInformation - 2020 - Refresh token issued -  - IdentityServer3.Core.Events.RefreshTokenDetails
Identity.Api.Monitoring.IdentityEventServiceInformation - 2000 - Access token issued -  - IdentityServer3.Core.Events.AccessTokenIssuedDetails
Identity.Api.Monitoring.IdentityEventServiceSuccess - 3000 - Endpoint success -  - IdentityServer3.Core.Events.EndpointDetail
IdentityServer3.Core.Endpoints.TokenEndpointControllerEnd token request
IdentityServer3.Core.Results.TokenResultReturning token response.

I get this response:

{
    "access_token": "myaccesstoken",
    "expires_in": 86400,
    "token_type": "Bearer",
    "refresh_token": "myrefreshtoken"
}

Now if I use that token on my request, I get a 401 unauthorized response:

enter image description here

At face value I'd expect this call to work, as I'm passing a correct token. So, what can I do to figure out why it doesn't work?

Upvotes: 0

Views: 555

Answers (1)

StefanE
StefanE

Reputation: 7630

Authorization header should have Bearer instead of BASIC

Authorization: Bearer SomeTokenHere

Upvotes: 1

Related Questions