From b6f04d1d2cc89c06e1a8200ec07301f3971832ca Mon Sep 17 00:00:00 2001 From: dienamo Date: Tue, 8 Oct 2024 14:33:57 +0200 Subject: [PATCH] =?UTF-8?q?:feat=20configuration=20de=20la=20d=C3=A9connex?= =?UTF-8?q?ion=20si=20erreur?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 2 -- src/services/auth/signInCallBack.js | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index ad668763..2191d5eb 100644 --- a/src/index.js +++ b/src/index.js @@ -11,7 +11,6 @@ import { AuthProvider } from 'react-oidc-context'; import { WebStorageStateStore } from 'oidc-client-ts'; import { BrowserRouter as Router } from 'react-router-dom'; import setup from './services/api'; -import signInCallBack from '../src/services/auth/signInCallBack'; import { MatomoProvider, createInstance } from '@jonkoops/matomo-tracker-react'; if (import.meta.env.VITE_APP_SENTRY_ENABLED === 'true') { @@ -47,7 +46,6 @@ const oidcConfig = { post_logout_redirect_uri: `${import.meta.env.VITE_APP_AUTH_REDIRECT_URI}/login`, userStore: new WebStorageStateStore({ store: window.localStorage }), scope: 'openid profile email', - onSigninCallback: () => signInCallBack(store), }; const instance = createInstance({ diff --git a/src/services/auth/signInCallBack.js b/src/services/auth/signInCallBack.js index b3c09c7e..d5c71093 100644 --- a/src/services/auth/signInCallBack.js +++ b/src/services/auth/signInCallBack.js @@ -16,6 +16,9 @@ const signInCallBack = async (dispatch, code, state, verificationToken) => { localStorage.setItem('loginError', JSON.stringify(error?.response?.data ?? 'Connexion refusée')); localStorage.removeItem('user'); dispatch({ type: 'LOGIN_FAILURE' }); + if (error.response?.data?.logoutUrl) { + return { success: false, logoutUrl: error.response.data.logoutUrl }; + } return { success: false }; } };