MSAL acquireTokenSilent didn't work even if activeAccount exist

Chiyang Huang 1 Reputation point

My system is created by React.
When my system refresh while user is logged in, it will do acquireTokenSilent,
but it console.log => atsMeasurement.addStaticFields is not a function,
If I use acquireTokenRedirect method will work, but i don't want to use redirect or popup to get new token.
Do anyone meet similar question? or suggest to get token by silent?

const getTokenResponse = async (msalInstance, activeAccount = null) => {
if (activeAccount === null) {
activeAccount = msalInstance.getActiveAccount();
console.log(activeAccount, "--activeAccount");
if (!activeAccount || activeAccount === null) return null;
const request = { ...tokenRequest, account: activeAccount };
try {
const response = await msalInstance.acquireTokenSilent(request);
console.log(response, "--response");
return response;
} catch (err) {
console.log(err, "-err");
await msalInstance.acquireTokenRedirect(request);
return err;

version :
"@azure/msal-browser": "^2.32.0",
"@azure/msal-common": "^7.3.0",
"react": "^17.0.2",

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,594 questions
{count} votes