I have a ReactJS application that uses Azure B2C for user sign up / sign in functionality. I want to be able to read / update the users data that is stored in B2C via the Microsoft Graph API.
What I've done so far is request an access token for the signed in user via acquireTokenSilent which successfully returns a jwt token. However when calling the Graph API I get a 401 Access token validation failure. Invalid audience
function requestProfile() {
instance.acquireTokenSilent({
scopes: ["offline_access"],
account: accounts[0]
}).then((response) => {
const token = response.idToken;
console.log(token);
callMsGraph(token, "GET", "https://graph.windows.net/v1.0/me").then(response => {
setGraphData(response.data);
console.log(response.data);
});
});
}
Is this even possible?