diff --git a/authentik/core/sources/flow_manager.py b/authentik/core/sources/flow_manager.py index d30802257a..9391efda12 100644 --- a/authentik/core/sources/flow_manager.py +++ b/authentik/core/sources/flow_manager.py @@ -212,7 +212,7 @@ class SourceFlowManager: def _prepare_flow( self, - flow: Flow, + flow: Flow | None, connection: UserSourceConnection, stages: list[StageView] | None = None, **kwargs, @@ -309,6 +309,8 @@ class SourceFlowManager: # When request isn't authenticated we jump straight to auth if not self.request.user.is_authenticated: return self.handle_auth(connection) + if SESSION_KEY_OVERRIDE_FLOW_TOKEN in self.request.session: + return self._prepare_flow(None, connection) connection.save() Event.new( EventAction.SOURCE_LINKED,