Hi
1) We are using Azure B2C to manage external users sign in, sign up, password reset, MFA for a Single page app . Currently we are using MSAL 2.2.0 (tried 2.4.1 as well) to login the user using the msal.loginredirect flow.
Once the user is logged in , we use the msal.getAllAccounts(); call to check if the user is logged in. Every time we refresh a page or navigate from one route to another the msal.getAllAccounts() return no accounts. If there are no accounts we cannot make the acquireTokenSilent call and have to make the login redirect call which is not a good solution.
How do we use the acquireTokenSilent flow without an account object ?
(I am using a custom policy in our use case and have defined session type/timeouts and token lifetimes in the sign in/sign up relying party file)
2) We are also using access tokens based on a scope defined on the API registration in B2C. Every time we make an API call we look for an access token with
the below request "msal.acquireTokenSilent(silentTokenRequest )", if the silent call fails we make a msal.loginredirect request again and look for the account needed for the silent call.
Is this the right way of handling access tokens as well ?
export const silentTokenRequest = {
scopes: ["https://abcd.onmicrosoft.com/api/data.write"],
account: null,
redirectUri: msalConfig.redirectUri,
forceRefresh: false
}
Thanks!
Sharat