authentik icon indicating copy to clipboard operation
authentik copied to clipboard

OIDC: Changing to default-invalidation-flow does not execute authentik logout

Open Crow-Control opened this issue 1 year ago • 10 comments

Describe the bug When setting a OIDC provider to default-invalidation-flow, the expectation is that it should end the authentik session when logging out from the connected application.

However it does not. It seems to still try and do the default-provider-invalidation-flow, however adding the default-invalidation-logout stage to default-provider-invalidation-flow also doesn't log out globally either.

Simply put: These two methods should be able to turn an application-specific oidc logout into a Authentik logout. But they dont.

Expected behavior An authentik logout should be done, it doesn't

Screenshots If applicable, add screenshots to help explain your problem.

Logs There are no docker-compose errors

Version and Deployment (please complete the following information):

  • authentik version: v2025.8.1
  • Deployment: docker-compose

Additional context

There might be some user error here, but even if there is: it should be (more) trivial to turn oidc-application-logout into a global (or at least Authentik, when there is no backchannel logout somewhere) logout

Crow-Control avatar Aug 30 '25 11:08 Crow-Control

I'm facing a similar issue, on setup, when applying a blueprint, i got :

Failed to apply blueprint.
name:default-invalidation-logout not found

With version 2025.8.2. I didnt have the issue on previous major verison (2025.6/2025.4/2025.2....so on for long time) Perhapse I'm missing something ?

here is part of the blueprint i'm trying to apply

## OAUTH PROVIDER
- attrs:
    access_code_validity: minutes=1
    access_token_validity: days=60
    authorization_flow: !Find [authentik_flows.flow, [slug, esd-provider-authorization-explicit-consent]]
    client_id: esd-metaenv
    client_secret: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3PebZydnKLwhhhREWblno9YOAk
    client_type: confidential
    include_claims_in_id_token: true
    invalidation_flow: !Find [authentik_flows.flow, [slug, default-invalidation-flow]]
    issuer_mode: per_provider
    name: esd-provider-oauth
    property_mappings:
    - !Find [authentik_providers_oauth2.scopemapping, [scope_name, openid]]
    - !Find [authentik_providers_oauth2.scopemapping, [scope_name, email]]
    - !Find [authentik_providers_oauth2.scopemapping, [scope_name, profile]]
    - !Find [authentik_providers_oauth2.scopemapping, [scope_name, metadata]]
    redirect_uris:
      - url: '.*'
        matching_mode: regex
    refresh_token_validity: days=70
    sub_mode: hashed_user_id
  conditions: []
  id: aaa-provider-oauth
  identifiers:
    name: aaa-provider-oauth
  model: authentik_providers_oauth2.oauth2provider
  state: present

skapin avatar Sep 17 '25 11:09 skapin

perhpase its related to https://github.com/goauthentik/authentik/issues/16685 ? since im using OAuth ?

skapin avatar Sep 17 '25 12:09 skapin

I'm facing a similar issue, on setup, when applying a blueprint, i got :

Failed to apply blueprint.
name:default-invalidation-logout not found

With version 2025.8.2. I didnt have the issue on previous major verison (2025.6/2025.4/2025.2....so on for long time) Perhapse I'm missing something ?

This does not look to be related at all, mine is about an existing stage not working correctly, yours is about a missing stage.

Crow-Control avatar Sep 18 '25 12:09 Crow-Control

perhpase its related to #16685 ? since im using OAuth ?

That issue lacks any basic info to be able to bug trace it, you didn't even specify what json you're sending/ It feels a bit like you're abusing this issue to push your own issues and bait for more attention tbh

Crow-Control avatar Sep 18 '25 12:09 Crow-Control

Oh I'm so sorry :'( ...I didn't want to hijack it and i'm so sad you feel that way.

I wanted to add a "perhapse" related issue close to yours. I will not post on your issue anymore don't worry.

Have a good day and good luck on debug.

skapin avatar Sep 18 '25 18:09 skapin

@skapin I'm not mad at you, I assume your intent is in the right place... But I also think its a bit distracting...

If the issues tend out to be more closely related as anticipated, be sure to tag this issue there (which is also a cleaner way of handling it than comments tbh)

Crow-Control avatar Sep 20 '25 11:09 Crow-Control

@BeryJu I still have not been able to get the two different logout stages to behave differently on latest release (aka global vs application logout)

Crow-Control avatar Sep 20 '25 11:09 Crow-Control

I can confirm that setting default-invalidation-flow as the invalidation flow in an OAuth2 provider indeed logs you out of authentik. However, you still get redirected to the end session page regardless. We should probably check for that in the SessionEndStage https://github.com/goauthentik/authentik/blob/main/authentik/flows/stage.py#L284, and redirect to / or wherever makes sense.

Keep in mind that the end-session endpoint needs to be configured on the application for it to redirect back to authentik to terminate the session there, otherwise, authentik has no way to know that you logged out of said application.

rissson avatar Sep 25 '25 12:09 rissson

Not marking this as a confirmed bug since the initial report isn't accurate.

rissson avatar Sep 25 '25 12:09 rissson

I am facing an issue logging out from Idp when while i am logged out from my frontend app and main OIDC, but from the idp i am unable to clear session, let me explain: I am using two instances of authentik

  1. vm2 is the main OIDC that is connected to my frontend app
  2. vm3 is the idp used for federated authentication now i am logged in through vm3 to vm2 and eventually logged in my frontend app, but when i logout it clear session of my frontend app and vm2 but it is unable to chain to vm3 the idp session clear like it should in single signout and after all sessions clear redirect back to my frontend app? any solution for that?

ahmedraza118 avatar Apr 14 '26 15:04 ahmedraza118