我从这里安装了AspNet-identity组件的每晚构建
似乎AuthenticationManager
RC版本的类已从RTM版本(Microsoft.AspNet.Identity.Owin.1.0.0-rtm-130914)中消失.
它曾经在Microsoft.AspNet.Identity.Owin程序集中,但它不再存在.
这个类有方法:SignInAsync
并且CheckPasswordAndSignInAsync
在创建具有个人用户帐户身份验证的新ASP.Net Web应用程序MVC项目时获得的默认项目中使用.
AuthenticationManager现在在哪里?或者用什么代替?
我发布了这个请求:
POST https://login.microsoftonline.com:443/{my-tennant-here}/oauth2/v2.0/token HTTP/1.1
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded
client_id={client id here}
&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default
&client_secret={client secret here}
&grant_type=client_credentials
这将返回:
{
"token_type": "Bearer",
"expires_in": 3599,
"ext_expires_in": 0,
"access_token": "eyJ0eX......
}
我已经使用 jwt.io 解码了令牌,它绝对不是空的。它包含 14 个声明。aud, iss, tid 等...
然后我在此请求中使用访问令牌
GET https://graph.microsoft.com/v1.0/users
Athorization: Bearer eyJ0eX...
然后我得到一个 401 Unauthorized 这个机构:
{
"error": {
"code": "InvalidAuthenticationToken",
"message": "Access token is empty.",
"innerError": {
"request-id": "",
"date": "2018-08-14T15:41:44"
}
}
}
预期结果是 200 Ok,正文包含用户列表
这是否仅仅意味着我的应用程序未经授权,并且错误消息只是具有误导性(访问令牌为空)?还是我做错了什么?
更新:我注意到虽然令牌确实包含声明,但它没有范围声明,这对我来说似乎有点奇怪。我会假设它具有 User.Read.All 范围。应用程序(客户端 ID/客户端机密)应该具有此权限。我收到的令牌中的声明具有以下声明:
aud: "https://graph.microsoft.com",
iss: "https://sts.windows.net/my tennant …
Run Code Online (Sandbox Code Playgroud) authentication azure azure-active-directory azure-ad-msal microsoft-graph-api