Blazor WebAssembly App with Individual User Accounts and Store user accounts in-app using no local user accounts

Blazor WebAssembly App with Individual User Accounts and Store user accounts in-app using gives no local user accounts

使用 Visual Studio 2019 16.8.2.NET 5.0 使用 Individual User AccountsStore user accounts in-app 创建一个新的 Blazor WebAssembly App 没有本地用户帐户。

启动应用程序时显示:

Before authentication will function correctly, you must configure your provider details in Program.cs

Program.cs:

public class Program
{
    public static async Task Main(string[] args)
    {
        var builder = WebAssemblyHostBuilder.CreateDefault(args);
        builder.RootComponents.Add<App>("#app");

        builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });

        builder.Services.AddOidcAuthentication(options =>
        {
            // Configure your authentication provider options here.
            // For more information, see https://aka.ms/blazor-standalone-auth
            builder.Configuration.Bind("Local", options.ProviderOptions);
        });

        await builder.Build().RunAsync();
    }
}

点击登录重定向到:

https://localhost:44444/authentication/login-failed

带有以下消息:

There was an error trying to log you in: 'Invalid response Content-Type: text/html, from URL: https:login.microsoftonline.com/.well-known/openid-configuration'

wwwroot -> appsettings.json 看起来像这样:

{
  "Local": {
    "Authority": "https://login.microsoftonline.com/",
    "ClientId": "33333333-3333-3333-33333333333333333"
  }
}

https://aka.ms/blazor-standalone-auth leads to https://docs.microsoft.com/en-gb/aspnet/core/blazor/security/webassembly/?view=aspnetcore-3.1

独立的 Blazor WebAssembly 应用程序似乎需要 Azure Active Directory (AAD)Azure Active Directory B2C (AAD B2C) 或另一个 Identity Provider (IP).

使用 Individual User AccountsStore user accounts in-app 创建另一个应用程序会提供 ASP.NET Core Identity 身份用户和他们自己的数据库。

您没有点击自托管所以它想连接到现有服务器。

您可以从 Index.razor 中删除它,这是来自 Index.razor 页面的硬编码消息。