diff --git a/openmetadata-ui/src/main/resources/ui/src/authentication/auth-provider/AuthProvider.tsx b/openmetadata-ui/src/main/resources/ui/src/authentication/auth-provider/AuthProvider.tsx index 7450949e2ae..08bbc369e4a 100644 --- a/openmetadata-ui/src/main/resources/ui/src/authentication/auth-provider/AuthProvider.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/authentication/auth-provider/AuthProvider.tsx @@ -557,6 +557,7 @@ export const AuthProvider = ({ {children} diff --git a/openmetadata-ui/src/main/resources/ui/src/authentication/authenticators/MsalAuthenticator.test.tsx b/openmetadata-ui/src/main/resources/ui/src/authentication/authenticators/MsalAuthenticator.test.tsx index f86fb33e412..39c6aeae568 100644 --- a/openmetadata-ui/src/main/resources/ui/src/authentication/authenticators/MsalAuthenticator.test.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/authentication/authenticators/MsalAuthenticator.test.tsx @@ -30,10 +30,12 @@ describe('Test MsalAuthenticator component', () => { it('Checks if the MsalAuthenticator renders', async () => { const onLogoutMock = jest.fn(); const onLoginMock = jest.fn(); + const onFailedLoginMock = jest.fn(); const authenticatorRef = null; render(

diff --git a/openmetadata-ui/src/main/resources/ui/src/authentication/authenticators/MsalAuthenticator.tsx b/openmetadata-ui/src/main/resources/ui/src/authentication/authenticators/MsalAuthenticator.tsx index 4b2da5abf5c..1561e8adb02 100644 --- a/openmetadata-ui/src/main/resources/ui/src/authentication/authenticators/MsalAuthenticator.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/authentication/authenticators/MsalAuthenticator.tsx @@ -13,6 +13,7 @@ import { InteractionStatus } from '@azure/msal-browser'; import { useAccount, useIsAuthenticated, useMsal } from '@azure/msal-react'; +import { AxiosError } from 'axios'; import React, { forwardRef, Fragment, @@ -32,11 +33,15 @@ import { interface Props { children: ReactNode; onLoginSuccess: (user: OidcUser) => void; + onLoginFailure: (error: AxiosError) => void; onLogoutSuccess: () => void; } const MsalAuthenticator = forwardRef( - ({ children, onLoginSuccess, onLogoutSuccess }: Props, ref) => { + ( + { children, onLoginSuccess, onLogoutSuccess, onLoginFailure }: Props, + ref + ) => { const { setIsAuthenticated, loading, setLoadingIndicator } = useAuthContext(); const { instance, accounts, inProgress } = useMsal(); @@ -115,6 +120,7 @@ const MsalAuthenticator = forwardRef( onLoginSuccess(user as OidcUser); } }) + .catch(onLoginFailure) .finally(() => { if (loading) { setLoadingIndicator(false);