From 2a8027deb071c24b3e0e3df569bcdc253db10606 Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Wed, 24 Jul 2024 22:27:55 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(frontend)=20support=20'silent'=20and?= =?UTF-8?q?=20'returnTo'=20params=20in=20authUrl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enhanced the authentication URL generation to support 'silent' and 'returnTo' query parameters. This allows initiating a silent login and specifying a custom return URL after auth. --- src/frontend/src/features/auth/utils/authUrl.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/features/auth/utils/authUrl.ts b/src/frontend/src/features/auth/utils/authUrl.ts index 111d1399..be5f4cd6 100644 --- a/src/frontend/src/features/auth/utils/authUrl.ts +++ b/src/frontend/src/features/auth/utils/authUrl.ts @@ -1,5 +1,5 @@ import { apiUrl } from '@/api/apiUrl' -export const authUrl = () => { - return apiUrl('/authenticate') +export const authUrl = (silent = false, returnTo = window.location.href) => { + return apiUrl(`/authenticate?silent=${encodeURIComponent(silent)}&returnTo=${encodeURIComponent(returnTo)}`) }