diff --git a/authentik/core/api/applications.py b/authentik/core/api/applications.py index 6e6db93df5..e3e4d8a111 100644 --- a/authentik/core/api/applications.py +++ b/authentik/core/api/applications.py @@ -8,6 +8,7 @@ from django.core.cache import cache from django.db.models import QuerySet from django.db.models.functions import ExtractHour from django.shortcuts import get_object_or_404 +from django.urls import reverse from drf_spectacular.types import OpenApiTypes from drf_spectacular.utils import OpenApiParameter, OpenApiResponse, extend_schema from guardian.shortcuts import get_objects_for_user @@ -65,10 +66,12 @@ class ApplicationSerializer(ModelSerializer): def get_launch_url(self, app: Application) -> str | None: """Allow formatting of launch URL""" - user = None - if "request" in self.context: - user = self.context["request"].user - return app.get_launch_url(user) + return reverse( + "authentik_core:application-launch", + kwargs={ + "application_slug": app.slug, + }, + ) def __init__(self, *args, **kwargs) -> None: super().__init__(*args, **kwargs)