1

我試圖在我的應用程序中將Google和Azure Active Directory權限添加爲OpenIdConnect選項。UseOpenIdConnectAuthentication - 無法解除郵件保護。狀態錯誤信息

如果我分別添加它們中的每一個,它工作正常。 但是,如果我加入他們兩個我得到以下錯誤信息:

無法取消保護message.State

這些都是OpenIdConnectOptions配置:

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

回答

2

當你有多個OIDC中間件,你需要爲每個人設置一個獨特的CallbackPath。否則,他們會在處理回調時踩到彼此的腳趾。

+0

是的,這是問題。我認爲只是驗證方案需要是唯一的。 – alessalessio

+0

我沒有多個OIDC中間件仍然面臨問題。有什麼建議麼? –