Search code examples
angularazure-active-directoryoffice-js

OfficeJS with Azure AD


Currently I have an OfficeJS with Angular setup and it works great. However I wanted to structure it in a way that it could call some of our existing API's. I then tried to create a connection with MSAL and Azure AD:

  OAuthSettings: {
    redirectUri: 'https://localhost:4200',
    clientId: 'clientId',
    tenentId: 'tenantID',
    scopes: ['api://api']
  }
};

When I bring the page up it logs in. However it doesn't authenticate in the excel pane. Not sure if it's because of redirects, etc. Any ideas on this?


Solution

  • It is recommended to use Office Dialog API to perform MSAL authentication. You can follow this guide to achieve this and it also outlines why it has to be done this way. https://learn.microsoft.com/en-us/office/dev/add-ins/develop/auth-with-office-dialog-api?view=common-js-preview.

    Hopefully that helps.