From 2b4443a47f54ced1100a8dfd42fdb30c1cdcf9bb Mon Sep 17 00:00:00 2001 From: Andrei Dekterev Date: Thu, 17 Feb 2022 16:09:04 +0700 Subject: [PATCH] fix(#2227): fix auth redirect for facr --- src/features/AuthServiceApp/components/Login/hooks.tsx | 5 ++++- src/features/AuthServiceApp/requests/auth.tsx | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/features/AuthServiceApp/components/Login/hooks.tsx b/src/features/AuthServiceApp/components/Login/hooks.tsx index 184625a9..c611748b 100644 --- a/src/features/AuthServiceApp/components/Login/hooks.tsx +++ b/src/features/AuthServiceApp/components/Login/hooks.tsx @@ -48,6 +48,7 @@ export const useLoginForm = () => { const submitForm = () => formRef.current?.submit() const redirect_url = new URLSearchParams(location.search).get('redirect_uri') + const clientId = new URLSearchParams(location.search).get('client_id') const { client_id, @@ -58,6 +59,7 @@ export const useLoginForm = () => { } = getClientSettings() const currentRedirectUrl = redirect_url ?? redirect_uri + const currentClientId = clientId ?? client_id const handleError = (error: string) => { setAuthError(error) @@ -69,6 +71,7 @@ export const useLoginForm = () => { setIsFetching(true) try { await loginCheck( + currentClientId, email, lang, password, @@ -86,7 +89,7 @@ export const useLoginForm = () => { return { authError, - client_id, + client_id: currentClientId, email, formError, formRef, diff --git a/src/features/AuthServiceApp/requests/auth.tsx b/src/features/AuthServiceApp/requests/auth.tsx index 531b5e22..bc971374 100644 --- a/src/features/AuthServiceApp/requests/auth.tsx +++ b/src/features/AuthServiceApp/requests/auth.tsx @@ -21,20 +21,20 @@ type SuccessResponse = { } export const loginCheck = async ( + currentClientId: string | undefined, email: string, lang: string, password: string, currentRedirectUrl: string | undefined, ) => { const { - client_id, response_mode, response_type, scope, } = getClientSettings() const paramsUrl = { - client_id, + client_id: currentClientId, lang, redirect_uri: currentRedirectUrl, response_mode,