0

I am using the Office.context.ui.displayDialogAsync method in Office.js to create a popup that allows the user to login.

I used the yeoman generator to create a React template for the Add-in. I could not find an Auth0 example using Office.js and React, so I used this example which does not use react: https://github.com/OfficeDev/Office-Add-in-Auth0

To display the dialog box I pass the displayDialogAsync method a url that looks like: https://localhost:3000/src/taskpane/popup.html.

The react way I thought of would be creating a react compoennt for the popup and then using react router (Hash router not Browser Router How to configure Office-js excel react add-in to use react-router-dom or alternative solutions?) to make the component accessible at {taskpane endpoint}/popup like on a website.

The addin locally runs at https://localhost:3000/taskpane.html so I tried to pass the url https://localhost:3000/taskpane.html/#popup but the popup is not routed to my component like it would on a normal react website. Instead I get a 404 error.

My question is do I need to add some additional configuration for this to work, or is it just not possible in Office.js.

2
  • Hash router would require you to use the # character. Have you tried navigating to {taskpaneendpoint}/#popup ? You should also share what your <Router> looks like Commented Sep 15, 2020 at 2:32
  • Hi Mavi, yes I have tried that but it did not work. Let me update the post. Commented Sep 16, 2020 at 0:59

1 Answer 1

1

Microsoft recommends that you not pass a route to the displayDialogAsync method. See this best practice: Best practices for using the Office Dialog API in an SPA.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.