Asp.net core 在热巧克力中使用授权时未调用HandleRequirementAsync 你好
我正在尝试在热巧克力Asp.net core 在热巧克力中使用授权时未调用HandleRequirementAsync 你好,asp.net-core,graphql,asp.net-authorization,hotchocolate,Asp.net Core,Graphql,Asp.net Authorization,Hotchocolate,我正在尝试在热巧克力graphql服务器中实现基于策略的授权。 我在看他们的,也指的是 我想要达到的目标 我希望在调用用户查询时调用HandleRequirementAsync() 我所做的 我在ConfigureServices 我声明了一个字段需要策略授权 我也有同样的问题。就我而言,我必须确保 public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 我有 app.UseAuthenti
graphql
服务器中实现基于策略的授权。
我在看他们的,也指的是
我想要达到的目标
我希望在调用用户查询时调用HandleRequirementAsync()
我所做的
我在ConfigureServices
我声明了一个字段需要策略授权
我也有同样的问题。就我而言,我必须确保
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
我有
app.UseAuthentication();
app.UseAuthorization();
先是然后是
app.UseWebSockets()
.UseGraphQL("/graphql")
.UsePlayground("/graphql")
.UseVoyager("/graphql");
{
"errors": [
{
"message": "The current user is not authorized to access this resource.",
"locations": [
{
"line": 3,
"column": 5
}
],
"path": [
"user",
"name"
],
"extensions": {
"code": "AUTH_NOT_AUTHENTICATED"
}
}
]
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
app.UseAuthentication();
app.UseAuthorization();
app.UseWebSockets()
.UseGraphQL("/graphql")
.UsePlayground("/graphql")
.UseVoyager("/graphql");