我使用以下库:“@azure/msal-browser”:“^2.16.0”、“@azure/msal-react”:“^1.0.1”、
我需要将用户重定向到登录屏幕,而用户无法看到任何内容。我怎么能做到这一点?
目前,我有这个:
export default function Main() {
const msalInstance = new PublicClientApplication(msalConfig);
useEffect(() => {
msalInstance
.handleRedirectPromise()
.then((s) => {
if (s === null) msalInstance.loginRedirect(loginRequest); // not logged in
else console.log(s); // logged in
})
.catch((a: any) => {
console.log("err");
console.log(a);
});
}, []);
return <App instance={msalInstance} />;
}
But, it loads the app for a second then does the redirection.