简体   繁体   中英

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:

在此处输入图片说明

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?

授权标头应具有Bearer而不是BASIC

Authorization: Bearer SomeTokenHere

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM