簡體   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