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

Suraj Sinha 10 Reputation points
2024-10-21T09:09:51.9666667+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:

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
Outlook | Windows | Classic Outlook for Windows | For business
Microsoft 365 and Office | Install, redeem, activate | For business | Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. David Chesnut 166 Reputation points Microsoft Employee
    2024-10-28T16:40:02.65+00:00

    Hi Suraj, I don't see anything wrong in the manifest XML that you shared. Can you try commenting out the line that sets forMSGraphAccess? This sometimes can cause error issues when sideloaded and testing (it does not cause issues when deployed from store or admin central deployment).

    Otherwise, is it possible that an older version of the manifest might still be loaded in Outlook that didn't have the up to date WebApplicationInfo section? To check this you could go to https://aka.ms/olksideload (the sideloaded apps page), where you can unload the add-in, then sideload the manifest again from that page to reload the manifest.

    Hope this helps,

    David

    0 comments No comments

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.