Coder Social home page Coder Social logo

Comments (4)

elegault avatar elegault commented on May 25, 2024 1

Thank you very much - I will get on all that!

from office-js-helpers.

WrathOfZombies avatar WrathOfZombies commented on May 25, 2024

So the issue here is that your Azure AD application has been set to redirect the user to a registered redirect_url with the user's token. This is done for security reasons.

However in OfficeHelpers, for convenience, we auto set the redirect url to your current application's domain, in this case, https://mywebapp.azurewebsites.net. In order to solve this please copy the redirect_url as is and use the advanced config as:

// set the redirect url by providing the config object.
authenticator.endpoints.registerMicrosoftAuth('client id here', {
    redirectUrl: 'redirect url here'
});

As for your issues with the browser execution, I have already started work on a new variant of this where it should resolve the cross-origin frame issues. I have received some feedback and I am trying to rectify the code while remaining backwards compatible.

In the meantime you can try the beta version here: https://unpkg.com/@microsoft/[email protected]/dist/office.helpers.js

Please try it out and let me know..

from office-js-helpers.

elegault avatar elegault commented on May 25, 2024

Note that I have been using registerAzureADAuth, not registerMicrosoftAuth, as Exchange Online permissions cannot be set using the latter type of application AFAIK. I had tried using the redirectUrl parameter with registerAzureADAuth but it didn't work (perhaps because I also included the responseType: 'id_token' parameter and value, which I'm not sure is incorrect or not). Should I try again using registerAzureADAuth and just the redirectUrl parameter? Also, it's not clear to me what I should use as the url - the domain only or the add-in's page url? If it's not the add-in URL will it still try to redirect to the default page at the root?

from office-js-helpers.

WrathOfZombies avatar WrathOfZombies commented on May 25, 2024

Let me break this down into multiple replies.

what I should use as the url

Please use a url that you'd want your users to be redirected to after login. This can be the default page at the root or a custom page saying authenticated. The only significance of this is that on AzureAD you're telling to send the user with the token back to this page and on the Add-in, we are waiting for this page to appear in the popup so that we can know when to close it automatically.

No matter what you decide, both the redirectUrl property and the redirectUrl set on Azure must match for a successful authentication.

Note that I have been using registerAzureADAuth, not registerMicrosoftAuth

Doesn't make a difference as all helpers registerXAuth use the same underlying code. So the overrides work consistently.

(perhaps because I also included the responseType: 'id_token' parameter and value, which I'm not sure is incorrect or not)

There's an active bug that I need to investigate (#54). Probably related to that.

Should I try again using registerAzureADAuth and just the redirectUrl parameter?

Yes please try that.

from office-js-helpers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.