Hi everyone
I am currently working on a tab application for MS Teams using Angular. I am trying to connect to API through Graph SDK. Here is my code :
const msalConfig = {
auth: {
clientId: '*********',
redirectUri: 'https://localhost:53000/auth-start'
}
};
this.msalInstance = new msal.PublicClientApplication(msalConfig);
this.msalInstance.initialize().then(async () => {
// Some callback function
const authProvider: AuthProvider = async (callback: AuthProviderCallback) => {
this.msalInstance.loginPopup({ scopes : ['user.read']}).then(response => {
console.log('AUTH RESPONSE', response);
callback(null, response.idToken);
}).catch(err => {
console.log('AUTH ERROR', err);
callback(err, null);
});
};
const options: Options = {
authProvider,
};
this.client = Client.init(options);
this.client.api('/me').get().then(response => {
console.log('GRAPH RESPONSE', response);
}).catch(err => {
console.log('GRAPH ERROR', err);
});
});
It seems that my function authProvider returns a valid token.
Then when exeuting this.client.api('/me').get() I get the following error :
Error: Access token validation failure. Invalid audience.
On Azure I added permissions on the following APIs

It seems I am missing something...