Logout is not worked for web forms C#

As per the documentation of OKTA, i’m used the following code:

HttpContext.GetOwinContext().Authentication.SignOut(
CookieAuthenticationDefaults.AuthenticationType,
OpenIdConnectAuthenticationDefaults.AuthenticationType);

This code generated the following error in sequence: {“errorCode”:“invalid_client”,“errorSummary”:“Invalid value for ‘client_id’ parameter.”,“errorLink”:“invalid_client”,“errorId”:“oaexwIxf_i7R7G7glBGFyR1JA”,“errorCauses”:[]}

Can someone help me?

Have you tried running the webforms sample app? - https://github.com/okta/samples-aspnet-webforms
It supports signout (https://github.com/okta/samples-aspnet-webforms/blob/918391e1f28b451531f33955e68a272712a4954b/okta-hosted-login/okta-aspnet-webforms-example/Site.Master.cs#L31)

And definitely cross-check the value of client_id you’ve set. The error seems to indicate that you might have set it incorrectly.

the your exemple dont worked in the my application,

this is my class .ccs:

using IdentityModel.Client;
using Microsoft.AspNet.Identity;
using Microsoft.IdentityModel.Logging;
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
using Microsoft.IdentityModel.Tokens;
using Microsoft.Owin;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Cookies;
using Microsoft.Owin.Security.OpenIdConnect;
using Owin;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Net;
using System.Security.Claims;

[assembly: OwinStartup(typeof(CIPP.Startup))]

namespace CIPP
{
public class Startup
{
private readonly string _clientId = ConfigurationManager.AppSettings[“okta:ClientId”];
private readonly string _redirectUri = ConfigurationManager.AppSettings[“okta:RedirectUri”];
private readonly string _authority = ConfigurationManager.AppSettings[“okta:OrgUri”];
private readonly string _clientSecret = ConfigurationManager.AppSettings[“okta:ClientSecret”];
private readonly string _postLogoutRedirectUri = ConfigurationManager.AppSettings[“okta:PostLogoutRedirectUri”];

    public void Configuration(IAppBuilder app)
    {
        ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
        ConfigureAuth(app);
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=316888
    }

    private void ConfigureAuth(IAppBuilder app)
    {
        IdentityModelEventSource.ShowPII = true;
        app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
        app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
        app.UseCookieAuthentication(new CookieAuthenticationOptions());

        app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
        {
            ClientId = _clientId,
            ClientSecret = _clientSecret,
            Authority = _authority,
            RedirectUri = _redirectUri,
            ResponseType = OpenIdConnectResponseType.CodeIdToken,
            PostLogoutRedirectUri = _postLogoutRedirectUri,
            Scope = OpenIdConnectScope.OpenIdProfile,
            TokenValidationParameters = new TokenValidationParameters { NameClaimType = "name" },
            Notifications = new OpenIdConnectAuthenticationNotifications


            {
            AuthorizationCodeReceived = async n =>
                {
                {
                    var tokenClient = new TokenClient($"{_authority}/v1/token", _clientId, _clientSecret);
                    var tokenResponse = await tokenClient.RequestAuthorizationCodeAsync(n.Code, _redirectUri);
                    var idToken = tokenResponse.IdentityToken;
                    CIPP.Business.Imports.Importa.geraToken(idToken);
                    if (tokenResponse.IsError)
                    {
                        throw new Exception(tokenResponse.Error);
                    }

                    var userInfoClient = new UserInfoClient($"{_authority}/v1/userinfo");
                    var userInfoResponse = await userInfoClient.GetAsync(tokenResponse.AccessToken);

                    var claims = new List<Claim>(userInfoResponse.Claims)
                {
                        new Claim("id_token", tokenResponse.IdentityToken),
                        new Claim("access_token", tokenResponse.AccessToken)
                };

                    n.AuthenticationTicket.Identity.AddClaims(claims);
                }
            }
            
            },
        });
    }
}

}

Looks is correct.