panva / openid-client

High-Level OAuth 2 / OpenID Connect Client API for JavaScript Runtimes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: end_session_endpoint must be configured on the issuer

IlirEdis opened this issue · comments

Describe the bug

Hi there,
When trying to create an endSessionUrl() to logout from my app i get TypeError: end_session_endpoint must be configured on the issuer

To Reproduce
Issuer and Client configuration: (inline or gist) - Don't forget to redact your secrets.

// Issuer configuration (issuer.metadata) and how it is constructed (discovery or manual?)
{
  const whmcsIssuer = await Issuer.discover(
    "https://example.com/oauth/openid-configuration.php"
  );
}
// Client configuration (client.metadata) and how it is constructed (fromUri or manual?)
{
  const client = new whmcsIssuer.Client({
    client_id: clientConfig.client_id!,
    client_secret: clientConfig.client_secret,
    response_types: ["code"],
    redirect_uris: [clientConfig.redirect_uri],
    token_endpoint_auth_method: "client_secret_post",
  });
}

Steps to reproduce the behaviour:

This is my logout api route:

export async function GET() {
  const session = await getSession();
  const client = await getClient();
  var endSession = client.endSessionUrl({
    post_logout_redirect_uri: clientConfig.post_logout_redirect_uri,
    id_token_hint: session.access_token,
    state: generators.state(),
  });

  session.isLoggedIn = defaultSession.isLoggedIn;
  session.access_token = defaultSession.access_token;
  session.userInfo = defaultSession.userInfo;
  session.code_verifier = defaultSession.code_verifier;
  await session.save();
  return Response.redirect(endSession);
}

Expected behaviour
A clear and concise description of what you expected to happen.

Environment:

  • openid-client version: v5.6.5
  • node version: v20.9.0

Additional context
Any help would be appreciated!

  • the bug is happening on latest openid-client too.
  • i have searched the issues tracker on github for similar issues and couldn't find anything related.

Hello @IlirEdis

This is not describing a bug in the module.

Sorry this should have been posted in Discussions. You can move it there and can you please help me solve this.
My issuer is WHMCS and i don't have access to add any endpoint there.