繁体   English   中英

Blazor WebAssembly 应用程序具有个人用户帐户和应用程序内存储用户帐户使用不提供本地用户帐户

[英]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不会提供本地用户帐户。

在此处输入图像描述

启动应用程序它说:

在验证 function 正确之前,您必须在 Program.cs 中配置您的提供程序详细信息

程序.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

带有以下消息:

尝试登录时出错:“无效的响应内容类型:文本/html,来自 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导致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 Accounts创建另一个应用程序并Store user accounts in-app会提供ASP.NET Core Identity标识用户和他们自己的数据库。

您没有单击自托管,因此它想要连接到现有服务器。

在此处输入图像描述

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

在此处查看 index.razor 页面

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM