Skip to content

Blazor WebAssembly: AddRemoteAuthentication(options) doesn't work #19854

Closed
@SteveSandersonMS

Description

@SteveSandersonMS

If you have this:

builder.Services.AddApiAuthorization();

Then things work fine. But if you have this:

builder.Services.AddApiAuthorization(options => { });

... then you get an exception like this:

Microsoft.JSInterop.JSException: Could not load settings from '_configuration/Microsoft.AspNetCore.Components.WebAssembly.Authentication'

Clearly the client name is wrong. And I think it's because of this line:

services.AddRemoteAuthentication<RemoteAuthenticationState, TProviderOptions>();

Shouldn't it instead be the following?

AddRemoteAuthentication<RemoteAuthenticationState, OidcProviderOptions>(services, configure);

Looks like there's a similar bug here too.

Also this suggests we're short on E2E test coverage.

Or am I misunderstanding how this API is meant to work?

Metadata

Metadata

Assignees

Labels

DoneThis issue has been fixedarea-blazorIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.feature-blazor-wasmThis issue is related to and / or impacts Blazor WebAssembly

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions