Skip to content

UNAUTHENTICATED error code #121

Description

@EbrahimMajdey

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<IHttpContextAccessor, HttpContextAccessor>();
            services.TryAddSingleton<IAuthorizationEvaluator, AuthorizationEvaluator>();
            services.AddTransient<IValidationRule, AuthorizationValidationRule>();
            services.AddTransient((c) =>{
                               var authSettings = new AuthorizationSettings();
                           authSettings.AddPolicy("authenticated",p=>p.RequireClaim(ClaimTypes.Name));
                          return authSettings;
            );
            app.UseAuthentication();
            app.UseAuthorization();
            app.UseGraphQL<MySchema>("/api");

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions