I am currently implementing SSO for one third-side service. The service doesn't support OIDC or OAuth, so I need to implement it proprietary. What I have is middleware, which handles requests. When it reckognizes request as login request from third side app, it creates authorize link and redirects it to [identityserver]/connect/authorize, which is authorize endpoint. Then server should give me back jwt token, which I would process. Anyway identity server gives me error and when I look into log file I can see failureReason="STATUS_CODE"
. But Response.Redirect()
sets status code 302, which should be just fine, shouldn't be?
Client is set up just fine. I am using Implicit flow. However for AuthorizationCode or ClientCredentials sends me to error page with message: The client application is not known or is not authorized. Status code 204.
Middleware snippet:
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;
Redirected link:
Result link:
https://localhost:44327/zendesk/authenticated#error=invalid_request&state=[64encodedValue]
Thanks for any hint, I am in dead end here.