I am implementing single-sign-on to Okta based on the following guide.
The guide targets .NET Core 3.1 (as opposed to .NET 7.0 which is what I am using) but it helped with implementing single-sign-on and that seems to be working as expected.
I have implemented single-sign-out as described in point 6. here.
This involved adding a controller action like this.
[HttpPost]
public IActionResult SignOut()
{
return new SignOutResult(
new[]
{
OktaDefaults.MvcAuthenticationScheme,
CookieAuthenticationDefaults.AuthenticationScheme,
},
new AuthenticationProperties { RedirectUri = "/Home/" });
}
I also configured the Okta Application with the Sign-out redirect URIs as described here. See point 9. in the second numbered list.
- Enter the Sign-out redirect URIs for both local development, such as
http://localhost:xxxx/signout/callback
.
When I make a request to the SignOut action on the controller, I can see that the user is being logged out of the cookie authentication scheme in the response. The cookie is set with an expiry in the past.
I can also see that the response redirects to the following URL. Note that I have redacted the Okta domain and state value.
The status of the response from that request is 400 Bad Request
.
Manipulating the Sign-out redirect URIs in the Okta Application (or even completely removing it) has no effect on the response to this request.
I also tried paring the action down to the following. This did not affect the Bad Request response.
public IActionResult SignOut()
{
return new SignOutResult(
new[]
{
OktaDefaults.MvcAuthenticationScheme,
});
}
I do not see entries in the Okta System Log that are related to these requests.
How can I resolve this issue and get single-sign-out to work as expected?
Is there a more relevant guide for .NET 7.0 that I should be working off?