OfficeDev / Word-Add-in-AngularJS-Client-OAuth

[ARCHIVED] Word add-in demonstrating client-side OAuth using Angular JS and ADAL for Angular
Other
8 stars 6 forks source link

Web app Error Sys.ArgumentNullException #6

Closed greg-e closed 7 years ago

greg-e commented 7 years ago

Runs as expected in Desktop Word. On Word Online (Office 365) get the following error @ word-web-16.00.js:19

Uncaught Error: Sys.ArgumentNullException: Value cannot be null.
Parameter name: conversationId at Function.a.create (word-web-16.00.js:19) at Function.a.argumentNull (word-web-16.00.js:19) at Function._validateParameterType (word-web-16.00.js:19) at Function._validateParameter (word-web-16.00.js:19) at Function._validateParams (word-web-16.00.js:19) at Microsoft.Office.Common.ClientEndPoint (word-web-16.00.js:19) at Object.connect (word-web-16.00.js:19) at OSF.InitializationHelper.setAgaveHostCommunication (word-web-16.00.js:19) at r (Office.js:12) at d (Office.js:12)

Rick-Kirkham commented 7 years ago

@greg-e I will try to reproduce, but I can't give you any time frame. In the meantime, your description says you are are working with "Word Online (Office 365)". Word Online, which is available to anyone with a Microsoft Account, is not quite the same thing as the Word service in Office 365, which requires an O365 account/license. Which is the one you are testing against? (Some aspects of the Office Add-in framework are supported on one, but not the other.)

greg-e commented 7 years ago

@Rick-Kirkham I am testing against the Word service in Office 365 ... this is intended to be an enterprise app that will ultimately connect with SharePoint Online

Rick-Kirkham commented 7 years ago

I'm not able to reproduce. When do you get the error and where do you see it? Is it when the task pane loads? When you press the Login with Office 365 button?

greg-e commented 7 years ago

@Rick-Kirkham man I wish I had your machine :).
First off, using Chrome dev tools.

First error is the one above 'Sys.ArgumentNullException: Value cannot be null'... happens when the add-in loads BEFORE 'Login' button push.

Second error that I saw after returning to this happens AFTER pushing the 'Login' button:

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://excel.officeapps.live.com') does not match the recipient window's origin ('https://blahblah.azurewebsites.net').

So not getting the token back from the dlg... I tried in IE11 with both targets as trusted sites... same error. Have also tried this on another machine with the same result. In this instance I had changed the Host to Workbook, but had the same result with Host Document.

Note that the manifest will not load in the Office 365 admin services & add-ins with `

or

https://graph.microsoft.com
<AppDomain>https://login.microsoftonline.com</AppDomain>

`

However the manifest will load in SharePoint app catalog with the <Requirements> dlg but not with the <AppDomains>

Please recommend another similar sample I can test before I loose my mind... thanks!

Rick-Kirkham commented 7 years ago

Hmmm. I'm publishing the manifest to a network share folder. Could you try that? If that works, then the problem must originate with how the add-in is published.

Also, are using the manifest with the default SourceLocation https://localhost:8443/index.html or have you changed this? If you haven't already, you should try to get the sample as is working on O365.

I don't think we have another sample that uses the Implicit Flow. There are other samples that connect to O365 with the server-side Auth Code flow. One is PowerPoint-Add-in-Microsoft-Graph-ASPNET-InsertChart.

greg-e commented 7 years ago

@Rick-Kirkham I had deployed to an Azure Website. Tried on localhost with success on desktop. On Office 365 Word Service still having the Sys.ArgumentNullException: Value cannot be null error when loading . No error after loggin but Calendar items do not show and no error in console. Shows the console.log(msg) from azureADConfig.js Logging.log function msg reads VERBOSE: Url: https://graph.microsoft.com/v1.0/me/events maps to resource: https://graph.microsoft.com Will try the server-side Auth Code flow.
Does this run for you in the Office 365 Word Service? Thanks for your help!

Rick-Kirkham commented 7 years ago

Yes. It works for me on O365 Word. (Hosting in localhost. I haven't tried hosting in Azure.) Since the problem seems to be with how the add-in is hosted and/or how the manifest is published, the problems are not really issues for this sample, per se, so I am closing this.

BTW, we have a new library, at office-js-helpers that is intended to make it easy to use the Implicit Flow with add-ins. We are working on a sample that uses the library, but it is not yet done. When it is, it will most likely have the name Excel-Add-in-Microsoft-Graph-MailMerge.