graphql-dotnet / graphql-dotnet/authorization
UNAUTHENTICATED error code
- Dominant language
- C#
- Stars
- 160
- Forks
- 38
- PR merge metrics
- No merged PRs in 30d
Description
I just need to know how to get the error code UNAUTHENTICATED because when I use .AuthorizeWith I am getting a VALIDATION_ERROR.
here is a bit of startup.cs
```
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
})
.AddJwtBearer();
```
```
services.TryAddSingleton();
services.TryAddSingleton();
services.AddTransient();
services.AddTransient((c) =>{
var authSettings = new AuthorizationSettings();
authSettings.AddPolicy("authenticated",p=>p.RequireClaim(ClaimTypes.Name));
return authSettings;
);
```
```
app.UseAuthentication();
app.UseAuthorization();
app.UseGraphQL("/api");
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.