I'm attempting to use the Blazor unified model with InteractiveAuto. Since the page could be rendered server-side, it requires I set up a GraphQL client on the server's Program.cs too. This works fine until I add required authorization. It then tries to authenticate again using OIDC instead of just using the cookie. I attempted to modify the request to include cookies, and also force the GraphQL authentication to use the Cookie scheme only, but no luck. What is strange is that the endpoint is returning a 404 instead of the expected 400.
I verified that there is an .AspNetCore.Cookies entry. Also, Nitro is able to query my authenticated endpoint without any Auth configuration when I'm logged in, which seems to point to the server not being the issue, as Nitro is passing through the cookie. If I'm logged out, Nitro receives the same 404 instead of 400.
Here's the relevant Auth & GraphQL setup (in Server-Side Program.cs).
// Add GraphQL servicesbuilder.Services .AddGraphQLServer() .AddQueryType<Query>() .AddMutationType<Mutation>() .AddAuthorization() .AddProjections() .AddFiltering() .AddSorting();// Add GraphQL Clientbuilder.Services.AddScoped(sp => new GraphQLHttpClient(config => { config.EndPoint = new Uri($"{sp.GetRequiredService<NavigationManager>().BaseUri}graphql"); config.HttpMessageHandler = new HttpClientHandler { CookieContainer = new CookieContainer(), UseCookies = true }; }, new SystemTextJsonSerializer()));// Add Azure AD authenticationbuilder.Services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme) .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAd"));...app.UseRouting();app.UseAuthentication();app.UseAuthorization();...app.MapGraphQL().RequireAuthorization(new AuthorizeAttribute{ AuthenticationSchemes = CookieAuthenticationDefaults.AuthenticationScheme});app.Run();