2016-11-16 31 views
0

我有一個隱式流程的客戶端配置。IdentityServer3隱式流程未啓用javascript

new Client 
    { 
     Enabled = true, 
     ClientId = "implicit", 
     ClientName = "Implicit Grant Flow", 
     Flow = Flows.Implicit, 
     RedirectUris = new List<string> 
     { 
       "http://localhost:24678/callback.html", 
     }, 
     AllowedScopes = new List<string> 
     { 
       Constants.StandardScopes.OpenId 
     } 
    } 

我想將我的javascript clint重定向到IdentityServer3登錄頁面。

 var url = "http://localhost:4751/connect/authorize" 
      + "?client_id=" + ("implicit") 
      + "&redirect_uri=" + encodeURIComponent("http://localhost:24678/callback.html") 
      + "&response_type=" + ("token") 
      + "&response_mode=" + ("form_post") 
      + "&scope=" + ("openid"); 

但出錯:

HTTP錯誤405.0 - 不允許的方法

+0

如果您打開日誌記錄在服務器上答案很可能會被揭示。 – GlennSills

回答

1

以下設置試試:

var url = "http://localhost:4751/connect/authorize" 
     + "?client_id=" + ("implicit") 
     + "&redirect_uri=" + encodeURIComponent("http://localhost:24678/callback.html") 
     + "&response_type=" + ("id_token") 
     + "&response_mode=" + ("fragment") 
     + "&scope=" + ("openid") 
     + "&nonce=none"; 
+0

這工作。但我可以在任何地方看到這個參數描述。 – barteloma

+0

這是[OpenID隱式流程的規格](http://openid.net/specs/openid-connect-implicit-1_0.html)。 –

+0

好的是隱式流的JavaScript應用程序類型的最佳解決方案。 – barteloma