For some background, I’m an operator on the C# Discord server. I like to hang out there to socialize and help people with C#.

Today a user named AndersNicolai had a very strange error when trying to use Identity Server 4 with ASP.NET Core 2. He was trying to configure Auth0 as an external OpenID Connect provider. The following image is the error he saw: Indentity Server 4 error

The error reads:

An unhandled exception occured while processing the Request.
InvalidOperationException: Cannot redirect to the end session endpoint, the configuration may be missing or invalid.

New users to C# will commonly ask for help before putting in any bit of effort. So my first assumption was that the configuration was missing or invalid. I asked the user to post his ServiceConfiguration method for the server and client. Hm, the configurations seemed to look correct. So next I busted out the Google.

It took me a bit of Googling to find the solution to this. One of the possible solutions I found involved injecting an event. That didn’t seem right to me though. I wanted to know why the server couldn’t redirect to the logout endpoint.

An Auth0 forum post from the Google search results sounded interesting. Anders’s config showed that he was trying to use Auth0 as his external provider! The answer to the forum post states that Identity Server tries to automatically discover the endpoint for OpenID Connect providers. Auth0 doesn’t provide the endpoint automatically because their implementation requires extra parameters. And that’s where the the Stack Overflow answer from before fits in! You need to add a handler for OnRedirectToIdentityProviderForSignOut to manually specify the SignOut url.

You can view the Auth0 sample implementation here.