I am trying to use teams to call the dynamics global discovery API on my react tab teams app.
I can get it working on postman following the guide here: https://learn.microsoft.com/en-gb/power-apps/developer/data-platform/discovery-service?WT.mc_id=ppac_inproduct_legacy however, when I try to call the API through teamsfx on my teams react app I am getting nothing back, but I am getting a 200 success code. I have implemented the the call as below.
await teamsUserCredential.login(["User.Read","https://globaldisco.crm.dynamics.com/user_impersonation"]);
const accessToken = await teamsUserCredential.getToken("https://globaldisco.crm.dynamics.com/user_impersonation");
const response = await fetch('https://globaldisco.crm.dynamics.com/api/discovery/v2.0/Instances', {
headers: {
Authorization: `Bearer ${accessToken.token}`,
}
});
I have also granted admin permission on the app registration, however am I right in saying this is not technically necessary as the login function should ask for permission at a user level?
Any help in getting me up and running so I can call the global discovery API would be much appreciated.