I am trying to use Sitecore 10.0.1, IdentityServer4, with Okta and OpenID Connect. When I click logout I get this error:
{"errorCode":"invalid_client","errorSummary":"A client_id must be provided in the request.","errorLink":"invalid_client","errorId":"oaevKZNtJFrRjqTZ_wCOsx6lA","errorCauses":[]}
Here is the OnRedirectToIdentityProviderForSignOut code:
options.Events.OnRedirectToIdentityProviderForSignOut += (Func<RedirectContext, Task>)(context =>
{
context.Request.QueryString.Add("client_id", identityProvider.ClientId); // Did not fix issue
context.Options.ClientId = identityProvider.ClientId; // Did not fix issue
context.Options.SignedOutRedirectUri = "https://id.myproject.localhost";
_logger.LogInformation("Redirect to identity provider for sign out. ClientId: {0}",
context?.Options?.ClientId);
context.ProtocolMessage.IdTokenHint = context.HttpContext.User.FindFirst("id_token")?.Value; // This returns null
_logger.LogInformation("IdTokenHint: {0}", context.ProtocolMessage.IdTokenHint);
return Task.CompletedTask;
});
options.Events.OnRedirectToIdentityProvider += (Func<RedirectContext, Task>)(context =>
{
_logger.LogInformation("Redirect to identity provider. IdToken: {0}.",
context.ProtocolMessage.IdToken);
var first = context.HttpContext.User.FindFirst("idp");
if (string.Equals(first?.Value, identityProvider.AuthenticationScheme, StringComparison.Ordinal))
context.ProtocolMessage.Prompt = "select_account";
return Task.CompletedTask;
});
I was thinking this might be related to IdTokenHint but I don't seem to have that available.
OnRedirectToIdentityProvider
event?