Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outlook Add-in with ADAL consistently fails #154

Closed
gavinbarron opened this issue Mar 8, 2016 · 8 comments
Closed

Outlook Add-in with ADAL consistently fails #154

gavinbarron opened this issue Mar 8, 2016 · 8 comments

Comments

@gavinbarron
Copy link

I realize that this might not be the appropriate place to raise this issue, happy to have it closed and open it elsewhere. Really want to get it out so that the right people can see the issue,

When using the generated code for an Outlook Add-In using ADAL the app crashes due to an error in the ADAL IFrame after-redirection back to the app.

The outlook-web-16.01.js script throws an errorSys.ArgumentNullException: Sys.ArgumentNullException: Value cannot be null. Parameter name: conversationId

Under the recommended approach this happens before the angular app has had a chance to bootstrap and causes the app to stop at this point.

Utilizing an ng-app directive to automate the bootstrap and moving the Office Initialize call inside the home controller allows the angular app to start in the IFrame and gather the ADAL access token thus allowing the main window to continue as it now has credentials to make ADAL secured calls.

This has also been noted on SO: http://stackoverflow.com/questions/35358911/first-time-loading-outlook-web-add-in-error-on-console

Happy to create a trivial re-pro if that's helpful

@gavinbarron
Copy link
Author

Created a repro repository and a branch with the trivial work around
https://github.com/gavinbarron/Outlook-ADAL-Issue
https://github.com/gavinbarron/Outlook-ADAL-Issue/tree/work-around

@jthake
Copy link
Contributor

jthake commented Mar 8, 2016

I was having a discussion with @richdizz that we may pull out ADAL.js usage in Office add-ins as this really doesn't work in production scenarios and there are better patterns to use. Such as that shown in the Clause Library code sample that use sockets via signalR. There is a node sample too that shows this and a document on MSDN also https://msdn.microsoft.com/en-us/library/office/mt629180.aspx

So I think the Issue is to actually remove ADAL.js from the generator. @waldekmastykarz what are your thoughts here?

@waldekmastykarz
Copy link
Contributor

It would be great to have an implementation that works everywhere every time, so if there is a better pattern than what we have in the generator now, let's replace it 😄

@scuba747
Copy link

Nine months have now gone by on this issue. Are there thoughts out there as to the approach that should be taken by developers to make their apps work from the generated add-in? Is dropping ADAL really the answer?

@nigel-dewar
Copy link

nigel-dewar commented Jan 10, 2017

@jthake , can you please elaborate on why "ADAL.js usage in Office add-ins as this really doesn't work in production scenarios and there are better patterns to use"?

@richdizz , could you please also weigh in on this also?

I mean, ADAL.js seem to work perfectly fine in an office add-in, (I am yet to use in production add-in though, but I use it in generic production web apps), and its allot simpler to work with than than nice and fancy but 'complicated' add-in solution using SignalR and storing access_token and refresh_token in database.

I am referencing this sample here https://github.com/OfficeDev/PnP-OfficeAddins/tree/master/Samples/Outlook.ConsumeGraphAPI which is not that old, "last commit Sept 6 2016" and it seems to work just fine. Is there something wrong with this?

I'm just trying to understand the reasoning on this. @richdizz , just FYI I have looked at your blogs, read your articles on this subject, looked at your samples etc, and thanks very much for providing all of this useful info. But it does not clarify to me why I would choose it over adal.js.

@kkrzaczkowski
Copy link

@jthake , Any progress with support of ADAL within Outlook add-in ?

@nigel-dewar , Is your office add-in still working with ADAL ?
My outlook add-in application worked 1 month ago but now is broken. I gets the same error like gavinbarron .

@nigel-dewar
Copy link

i mate i gave up on adal.js in general as just doesnt seem to be much interest in supporting it.

i ended up referencing this project

https://github.com/OfficeDev/PnP-OfficeAddins/tree/master/Samples/Outlook.MailCRM/DXDemos.Office365

which seems to be best option. This one you have your user sign in using openidconnect and store the users token in the tokencache server side. The project provides a key back to the addin. It seems to work pretty well.

I didnt want to go dowb this road as i do find adal.js quite simple, but this sample does work and means your users will not need to sign in very often. All the token refresh will happen server side.

let me know if this works foe u. If you get stuff and need to use adal then let me know and ill try help out. Nige.

@peombwa
Copy link

peombwa commented Mar 29, 2017

@gavinbarron Kindly explain the work around you used here https://github.com/gavinbarron/Outlook-ADAL-Issue/tree/work-around

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants