Skip to content

Blazor MSAL RedirectToLogin.razor out of dateΒ #63199

@jbw716

Description

@jbw716

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

The sample RedirectToLogin.razor component that is linked to in the Blazor MSAL docs is out of date since .NET 7+.

https://github.com/dotnet/aspnetcore/blob/v9.0.0/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Layout/RedirectToLogin.razor

Expected Behavior

Should be update to the following as per the .NET breaking changes doc:
https://learn.microsoft.com/en-us/dotnet/core/compatibility/aspnet-core/7.0/wasm-app-authentication#recommended-action

@inject NavigationManager Navigation
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication
@using Microsoft.Extensions.Options

@inject IOptionsSnapshot<RemoteAuthenticationOptions<ApiAuthorizationProviderOptions>> Options
@code {

    protected override void OnInitialized()
    {
        Navigation.NavigateToLogin(Options.Get(Microsoft.Extensions.Options.Options.DefaultName).AuthenticationPaths.LogInPath);
    }
}

Steps To Reproduce

Current:
https://github.com/dotnet/aspnetcore/blob/v9.0.0/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Layout/RedirectToLogin.razor

Expected:
https://learn.microsoft.com/en-us/dotnet/core/compatibility/aspnet-core/7.0/wasm-app-authentication#recommended-action

Exceptions (if any)

No response

.NET Version

7+

Anything else?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions