I am trying to login user seamlessly, with out having a login button as it will be hosted on Azure. But ending in infinite loop with error:
interaction_in_progress: Interaction is currently in progress.
Please ensure that this interaction has been completed before calling an interactive API.
For more visit: aka.ms/msaljs/browser-errors.
Sample Pagelayout code modified Typescript sample from https://github.com/AzureAD/microsoft-authentication-library-for-js:
export const PageLayout = (props: any) => {
const { instance,accounts,inProgress } = useMsal();
if(instance.getActiveAccount() == null)
{
console.log('account =' + instance.getActiveAccount());
instance.loginRedirect(loginRequest);
}
console.log('count =' + instance.getAllAccounts().length);
console.log('active =' + instance.getAllAccounts());
return (
<>
<Navbar bg="primary" variant="dark">
<a className="navbar-brand" href="/">MS Identity Platform</a>
{/* <SignInSignOutButton/> */}
</Navbar>
<h5 className="sample-header">Welcome to the Microsoft Authentication Library For Typescript - React Quickstart</h5>
<br/>
<br/>
{props.children}
</>
);
};