Error 13004 with "Office.Auth" Interface in React.js Outlook Add-in - "Invalid application resource URL provided."

Suraj Sinha 10 Reputation points
2024-10-15T07:58:10.63+00:00

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:

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);
}```

We are using the add-in in local development mode (localhost).

The error occurs right after calling Office.Auth.getAccessToken.

We have tried Authenticating Office.Auth interface in Outlook Web application.

Cleared cache and reinstalled the manifest after each change.

Verified that the app is correctly registered in the Azure portal.

Confirmed the redirect URI is set to **https://localhost:3000  **in Azure.

Error 13004:

```{
   "name": "Invalid application resource URL provided.",
   "message": "Invalid resource URL specified in the manifest.",
   "code": 13004
}```

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!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);
}```
  • We are using the add-in in local development mode (localhost).
  • The error occurs right after calling Office.Auth.getAccessToken.
  • We have tried Authenticating Office.Auth interface in Outlook Web application.
  • Cleared cache and reinstalled the manifest after each change.
  • Verified that the app is correctly registered in the Azure portal.
  • Confirmed the redirect URI is set to **https://localhost:3000  **in Azure. Error 13004:
      ```{
       "name": "Invalid application resource URL provided.",
       "message": "Invalid resource URL specified in the manifest.",
       "code": 13004
    

}```

  
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!
Microsoft 365 and Office | Development | Other
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.