Skip to content

ASP.NET Core server-side and Blazor Web App #35634

@saraghadyani

Description

@saraghadyani

Description

I am following the method in "ASP.NET Core server-side and Blazor Web App additional security scenarios" and implemented them in my blazor web app (server based). I get an exception

InvalidOperationException: No authentication handler is registered for the scheme 'OpenIdConnect'. The registered schemes are: MicrosoftOidc, Cookies. Did you forget to call AddAuthentication().AddSomeAuthHandler?

if instead of :

using Microsoft.AspNetCore.Authentication.OpenIdConnect;

...

app.MapRazorComponents().RequireAuthorization(
new AuthorizeAttribute
{
AuthenticationSchemes = OpenIdConnectDefaults.AuthenticationScheme
})
.AddInteractiveServerRenderMode();

I replace it with

app.MapRazorComponents()
.AddInteractiveServerRenderMode();

The web app runs without error, but going to login page in web app I get following error:

OpenIdConnectProtocolException: Message contains error: 'invalid_request', error_description: 'AADB2C90012: The scope 'openid profile offline_access' provided in request is not supported.
Correlation ID: df101545-3015-4419-a1f9-a3a535b1caf2
Timestamp: 2025-06-17 15:02:31Z
', error_uri: 'error_uri is null'.

Page URL

https://learn.microsoft.com/en-us/aspnet/core/blazor/security/additional-scenarios?view=aspnetcore-9.0&source=docs

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/blazor/security/additional-scenarios.md

Document ID

85d1072a-59eb-7b01-2476-fa699ee03653

Platform Id

0bb44a31-eea5-7fdc-3d77-85dbf2f31315

Article author

@guardrex

Metadata

  • ID: 85d1072a-59eb-7b01-2476-fa699ee03653
  • PlatformId: 0bb44a31-eea5-7fdc-3d77-85dbf2f31315
  • Service: aspnet-core
  • Sub-service: blazor

Related Issues

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions