我目前正在爲一項第三方服務實施SSO。該服務不支持OIDC或OAuth,所以我需要實現它的專有權。我擁有的是處理請求的中間件。當它從第三方應用程序重新確認請求爲登錄請求時,它會創建授權鏈接並將其重定向到作爲授權端點的[identityserver]/connect/authorize。然後服務器應該給我回jwt令牌,我會處理。無論如何身份服務器給我錯誤,當我看着日誌文件,我可以看到failureReason="STATUS_CODE"
。但是Response.Redirect()
集狀態碼302,這應該是好的,不應該?IdentityServer身份驗證端點 - >錯誤= invalid_request failureReason =「STATUS_CODE」
客戶端設置得很好。我正在使用隱式流。然而,對於AuthorizationCode或ClientCredentials,我會發送消息給錯誤頁面:客戶端應用程序未知或未經授權。狀態代碼204
中間件片段:
string url = $"{context.Request.Scheme}://{context.Request.Host}";
DiscoveryClient discoveryClient = new DiscoveryClient("https://localhost:44300/");
DiscoveryResponse doc = await discoveryClient.GetAsync();
AuthorizeRequest authorizeRequest = new AuthorizeRequest(doc.AuthorizeEndpoint);
string authorizeUrl = authorizeRequest.CreateAuthorizeUrl(
clientId: "zendesk",
responseType: "id_token token",
scope: "openid email profile",
redirectUri: $"{url}/zendesk/authenticated",
state: Base64Url.Encode(returnTo.ToBytes()));
context.Response.Redirect(authorizeUrl);
return;
重定向鏈接:
結果鏈接:
https://localhost:44327/zendesk/authenticated#error=invalid_request&state=[64encodedValue]
感謝您的任何暗示,我在死衚衕在這裏。