【发布时间】:2023-01-24 23:33:32
【问题描述】:
我已经有一个现有的 Blazor WebAssembly 应用程序,我正在尝试使用 Azure Active Directory 添加身份验证。
我添加了Microsoft.Authentication.WebAssembly.Msal nuget。
在我服务器的Program.cs 中,我添加了以下代码:
builder.Services.AddMsalAuthentication(options =>
{
builder.Configuration.Bind("AzureAd", options.ProviderOptions.Authentication);
options.ProviderOptions.LoginMode = "redirect";
});
我已经将以下内容添加到我的 appsettings.json
"AzureAd": {
"Instance": "xxxxxxxxxxx",
"Domain": "xxxxxxxxxxx",
"TenantId": "xxxxxxxxxxx",
"ClientId": "xxxxxxxxxxx",
"CallbackPath": "xxxxxxxxxxx"
},
我很难理解我还需要添加什么,以便在运行该应用程序时,我会看到 Microsoft 登录屏幕。
【问题讨论】:
标签: authentication azure-active-directory blazor blazor-webassembly