We are developing a React.js-based Outlook add-in and tried to authenticate using the Office.Auth
interface with an app registered in the Azure portal. Our configuration follows the official Microsoft documentation:
Office.Auth Documentation
WebApplicationInfo Element
Manifest Configuration:
```<WebApplicationInfo>
<Id>{APP_ID}</Id>
<Resource>api://localhost:3000/{APP_ID}</Resource>
<Scopes>
<Scope>Files.Read.All</Scope>
<Scope>offline_access</Scope>
<Scope>openid</Scope>
<Scope>profile</Scope>
</Scopes>
</WebApplicationInfo>```
For local development, we set the Resource
to api://localhost:3000/ {APP_ID}
based on the documentation guidelines.
Office.Auth Code:
```try {
const accessToken = await Office.auth.getAccessToken({
allowSignInPrompt: true,
allowConsentPrompt: true,
forMSGraphAccess: true,
});
console.log("accessToken", accessToken);
} catch (error) {
console.log("Error obtaining token", error);
}```
}```
Based on the documentation, we anticipated that by properly configuring the "WebApplicationInfo" section in the manifest, setting the Resource to api://localhost:3000/ {APP_ID} for local development, and registering the app in the Azure portal, the authentication flow would work smoothly, without any errors related to the resource URL.
Office.Auth.getAccessToken() function should return an access token, allowing my React.js-based Outlook add-in to authenticate successfully, but it is throwing error 13004, Any suggestions to this problem would be greatly appreciated!