UseOpenIdConnectAuthentication-无法取消保护消息状态错误消息
问题描述:
我正在尝试在应用程序中将Google和Azure Active Directory授权添加为OpenIdConnect选项.
I am trying to add Google and Azure Active Directory authorities as OpenIdConnect options in my application.
如果我分别添加它们,那么效果很好. 但是,如果我同时添加它们,则会收到以下错误消息:
If i add each of them separately, it works fine. But if i add them both i get the following error message:
无法取消保护邮件.状态
这些是OpenIdConnectOptions配置:
These are the OpenIdConnectOptions configuration:
//Google
appBuilder.UseOpenIdConnectAuthentication(new OpenIdConnectOptions
{
ClientId = ".....apps.googleusercontent.com",
Authority = $"https://accounts.google.com",
ClientSecret = "xxxyyyzzzz",
AuthenticationScheme = "Google",
DisplayName = "Google",
AutomaticChallenge = true
});
//Azure AD Providers
var schemeName = "Azure Active Directory";
var clientId = "1234567890";
var tenantId = "0987654321";
appBuilder.UseOpenIdConnectAuthentication(new OpenIdConnectOptions
{
ClientId = clientId,
ClientSecret = "aaaaabbbbcccc",
Authority = $"https://login.microsoftonline.com/{tenantId}",
AuthenticationScheme = "Azure Active Directory",
DisplayName = "Azure Active Directory",
AutomaticChallenge = true,
});
答
当您有多个OIDC中间件时,需要为每个中间件设置唯一的CallbackPath
.否则,在处理回调时,它们会踩到对方的脚趾.
When you have multiple OIDC middleware, you need to set a unique CallbackPath
for each of them. Otherwise they are stepping on each other's toes when handling the callback.