From 5886688faec867a0291b916ba2c91e96d80d9a29 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 28 Aug 2022 15:59:34 +0200 Subject: [PATCH] core: make request in context optional for Applications API Signed-off-by: Jens Langhammer #3482 --- authentik/core/api/applications.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/authentik/core/api/applications.py b/authentik/core/api/applications.py index 7cada1ecc..85cd369b5 100644 --- a/authentik/core/api/applications.py +++ b/authentik/core/api/applications.py @@ -50,7 +50,9 @@ class ApplicationSerializer(ModelSerializer): def get_launch_url(self, app: Application) -> Optional[str]: """Allow formatting of launch URL""" - user = self.context["request"].user + user = None + if "request" in self.context: + user = self.context["request"].user return app.get_launch_url(user) class Meta: