I'm using msal.js in my react project for authentication. In that, I have a profile edit option.
steps in profile edit
- Update the database
- Update B2C profile name with Graph API
So once I edit the name, the B2C profile name is updated. But not the id_token. I wanna force refresh the id_token form B2C. The acquireTokenSilent method is always fetching the token from the cache. Is there any way to force the application to get the new token from B2C?
here is my code for acquireTokenSilent method
async acquireToken(request, redirect) {
return msalApp
.acquireTokenSilent(request)
.then((loginResponse) => {
console.log('gg');
if (loginResponse) {
console.log(loginResponse);
this.setState({
account: loginResponse.account,
isAuthenticated: true,
error: null,
});
return true;
}
})
.catch((error) => {
// Call acquireTokenPopup (popup window) in case of acquireTokenSilent failure
// due to consent or interaction required ONLY
if (requiresInteraction(error.errorCode)) {
this.setState({
isAuthenticated: false,
});
return redirect ? msalApp.acquireTokenRedirect(request) : this.onSignIn(redirect);
}
console.error('Non-interactive error:', error.errorCode);
return false;
});
}