UseOpenIdConnectAuthentication - Unable to unprotect the message.State Error Message

家住魔仙堡 提交于 2020-01-24 20:43:30

问题


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:

Unable to unprotect the message.State

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,                                                
        });

回答1:


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.



来源:https://stackoverflow.com/questions/43758879/useopenidconnectauthentication-unable-to-unprotect-the-message-state-error-mes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!