I've created a React.js-based Outlook add-in where I've loaded Office.js using a CDN link, and the Office API has successfully initialized. I'm using the Office.Auth API to obtain an access token for an application registered in the Azure portal. I've also added Microsoft Graph permissions and included them in the application's configuration shown in snapshot.
Also, I have added Scopes in "webApplicationInfo" element as shown in snapshot.
For local testing, I've set up the Application ID URI as "api://localhost:3000/{APP_ID}"
and preauthorized the application with "ea5a67f6-b6f3-4338-b240-c655ddc3cc8e" as specified in Microsoft's documentation.
https://learn.microsoft.com/en-us/office/dev/add-ins/develop/register-sso-add-in-aad-v2
While I can successfully retrieve an access token using the Office.Auth API through below code.
Attempting to use this token to call Microsoft Graph API results in an error:
"code": "InvalidAuthenticationToken",
"message": "Access token validation failure. Invalid audience."
Please assist.