UseOpenIdConnectAuthentication - 无法取消保护消息.状态错误消息 [英] UseOpenIdConnectAuthentication - Unable to unprotect the message.State Error Message

查看:35
本文介绍了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.

这篇关于UseOpenIdConnectAuthentication - 无法取消保护消息.状态错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆