fix(#2227): fix auth redirect for facr

keep-around/2b4443a47f54ced1100a8dfd42fdb30c1cdcf9bb
Andrei Dekterev 4 years ago
parent 7991b3a157
commit 2b4443a47f
  1. 5
      src/features/AuthServiceApp/components/Login/hooks.tsx
  2. 4
      src/features/AuthServiceApp/requests/auth.tsx

@ -48,6 +48,7 @@ export const useLoginForm = () => {
const submitForm = () => formRef.current?.submit() const submitForm = () => formRef.current?.submit()
const redirect_url = new URLSearchParams(location.search).get('redirect_uri') const redirect_url = new URLSearchParams(location.search).get('redirect_uri')
const clientId = new URLSearchParams(location.search).get('client_id')
const { const {
client_id, client_id,
@ -58,6 +59,7 @@ export const useLoginForm = () => {
} = getClientSettings() } = getClientSettings()
const currentRedirectUrl = redirect_url ?? redirect_uri const currentRedirectUrl = redirect_url ?? redirect_uri
const currentClientId = clientId ?? client_id
const handleError = (error: string) => { const handleError = (error: string) => {
setAuthError(error) setAuthError(error)
@ -69,6 +71,7 @@ export const useLoginForm = () => {
setIsFetching(true) setIsFetching(true)
try { try {
await loginCheck( await loginCheck(
currentClientId,
email, email,
lang, lang,
password, password,
@ -86,7 +89,7 @@ export const useLoginForm = () => {
return { return {
authError, authError,
client_id, client_id: currentClientId,
email, email,
formError, formError,
formRef, formRef,

@ -21,20 +21,20 @@ type SuccessResponse = {
} }
export const loginCheck = async ( export const loginCheck = async (
currentClientId: string | undefined,
email: string, email: string,
lang: string, lang: string,
password: string, password: string,
currentRedirectUrl: string | undefined, currentRedirectUrl: string | undefined,
) => { ) => {
const { const {
client_id,
response_mode, response_mode,
response_type, response_type,
scope, scope,
} = getClientSettings() } = getClientSettings()
const paramsUrl = { const paramsUrl = {
client_id, client_id: currentClientId,
lang, lang,
redirect_uri: currentRedirectUrl, redirect_uri: currentRedirectUrl,
response_mode, response_mode,

Loading…
Cancel
Save