0

I want to add authorization to my project based on this tutorial. I've got the part of retrieving an access token working. But when using the token to access a protected resource API I get a 401 unauthorized error.

The request has an authorization header with scheme Bearer and containing the access token. Like in the tutorial the API is protected with the [Authorize] attribute. During startup I setup Bearer Authentication with

UseOAuthBearerAuthentication(new Microsoft.Owin.Security.OAuth.OAuthBearerAuthenticationOptions())

It is not clear to me why the request is unauthorized. What can I check to find the cause of this problem?

4

1 回答 1

2

在尝试和检查了很多东西之后,我注意到授权服务器和资源服务器使用的是不同版本的 Owin 和 Owin.Security。更新旧的后,它工作。令牌必须在 2 个版本之间发生更改。

于 2016-07-28T06:33:37.360 回答