A React wrapper for Azure AD using the Microsoft Authentication Library (MSAL). The easiest way to integrate AzureAD with your React for authentication.
Describe the bug
I've attempted to replace ADAL with MSAL. The first time the user accesses the app it authenticates correctly, but I am getting into a situation where our app goes into a redirect loop after a period of time. I presume this is when the token expires (1 hour by default, I believe). This happens sometimes when the app is idle after an hour, which is why I think it may be to do with the way a new token is obtained as well as when I refresh the browser window.
AuthProvider.ts
import { MsalAuthProvider, LoginType } from "react-aad-msal";
Library versions
react-aad-msal: 2.3.5 msal: 1.3.2
Describe the bug I've attempted to replace ADAL with MSAL. The first time the user accesses the app it authenticates correctly, but I am getting into a situation where our app goes into a redirect loop after a period of time. I presume this is when the token expires (1 hour by default, I believe). This happens sometimes when the app is idle after an hour, which is why I think it may be to do with the way a new token is obtained as well as when I refresh the browser window.
AuthProvider.ts
import { MsalAuthProvider, LoginType } from "react-aad-msal";
export const authProvider = new MsalAuthProvider( { auth: { authority: 'https://MxHHStaging.b2clogin.com/MxHHStaging.onmicrosoft.com/B2C_1_SUSI', clientId: '',
postLogoutRedirectUri: window.location.origin,
redirectUri: window.location.origin,
validateAuthority: false,
navigateToLoginRequestUrl: false,
},
}, { scopes: ['https://MxHHStaging.onmicrosoft.com/Web/userimpersonation'], }, { loginType: LoginType.Redirect, tokenRefreshUri: window.location.origin + '/auth.html', } );
const token = await authProvider.getAccessToken()
this will provide error redirect to home screen.