PDA

View Full Version : WebOrderMail Demo application



Mike Peat
24-Sep-2015, 10:38 AM
I have just created an Office 365 demo application based on the standard WebOrder sample: 9280

I have modified it as follows:



Made Customer.EMail_Address no longer "required" (I just commented-out that line in the DDO)
Cleared down all of the customer e-mail addresses (which of course were bogus)
Added the Office 365 API library and (which you should map to your own copy - it isn't included - get it here (http://support.dataaccess.com/Forums/attachment.php?attachmentid=9278&d=1443028243), while you can get the OAuth2 library it uses here (http://support.dataaccess.com/Forums/attachment.php?attachmentid=9277&d=1443020867))
Added the OAuth2 AppHTML subdirectory (it can be found in the Office 365 Component's AppHTML directory)
Edited Index.html to use the OAuth2 JavaScript component
Added code into the Order web view to allow it to send e-mail via Office 365 Outlook Mail
At the bottom of the view, added a checkbox to say whether to send mail on every save (which means every time an order detail line is modified, as well as on explicit saves of the order header)
Added a button to explicitly send mail (only works if you have an order up)
Added a Yes/No to ask if you want to send mail
Added a pop-up dialog to allow input of an e-mail address if the customer for the order doesn't have one (which none of them do after the second step above) with an option to save it to the customer


You will need an Office 365 account in order for it to work.

Mike

Mike Peat
29-Sep-2015, 04:58 AM
Just a quick note - I notice I left a few breakpoints set, so if you are running under the debugger then they will do irritating things as e-mail attempts to send.

My bad. :mad:

Mike

Marco
30-Sep-2015, 01:18 AM
Hi Mike

The WeborderMail workspace has a full path library
Lib1=C:\Projects\Office365interface\Office365inter face.sws
I suggest for the next version to make this relative
Lib1=..\Office365interface\Office365interface.sws

Also the link was to DFOAuth2-Beta1 instead of Beta2
Lib1=C:\Projects\DFOAuth2-Beta1\OAuth2.sws
to
Lib1=..\DFOAuth2-Beta2\OAuth2.sws

On sending email, again got



Sign In


Sorry, but we’re having trouble signing you in.We received a bad request.











Additional technical information:


Correlation ID: 9d21f28c-4cb1-4909-8c96-9cf711454306


Timestamp: 2015-09-30 06:11:47Z


AADSTS70001: Application with identifier '9e642308-e5f1-40d6-a476-e761cf97ed28' was not found in the directory 28it.com.au








This time I made sure that I have exactly the same local URL as the one in the source code.
I did not attempt to register this app myself on Azure, just keep the defaults.

Kind regards
Marco

Mike Peat
30-Sep-2015, 02:48 AM
Marco

That's weird. As I said in another thread, I tried all this stuff on a fresh Amazon server based in Dublin and it all worked fine. Maybe I should try it on one in Sydney. I'll do that now.

The only clue I can see is that bit about the Application ID (client id) not being found in the directory 28it.com.au. Is there some sort of proxy server involved there? Are they trying to provide Azure services from it? I just don't know, but I do find the reference to your ISP very strange. Why are they in the loop? Shouldn't they just be passing your stuff directly along to Microsoft's authentication server login.windows.net?

Mike

Mike Peat
30-Sep-2015, 07:05 AM
Marco

OK, after fighting a bit I got an Amazon server set up in their Sydney data center (I'm being extra-dumb today: two failed attempts, just being stupid).

After adding in IIS with all the required trimmings, I downloaded and installed DF 18.1, then from this forum I downloaded the OAuth2 beta 2, the Office365Interface alpha 2 and the WebOrderMail sample.

After extracting them from their zips, I opened them one-by-one in the studio, fiddled with libraries as required, registered their web apps... and everything worked.

So it isn't just being in Oz that is the problem. I still think it has to do with your ISP (I assume that is who 28it.com.au are). The only other variable I can think of is that you are logging in as you and not me! (If you want to test that, I am willing to e-mail you my Office 365 credentials, but I think the problem is actually happening before you get to that stage.)

Mike

Marco
30-Sep-2015, 07:20 AM
Thanks Mike
28it.com.au is my domain, and linked to my business account with Microsoft office 365.
Not sure what is going on.
So are you saying, that you expected the app to be registered and 'any' login should be able to use the app?
Cheers
Marco

Mike Peat
30-Sep-2015, 08:54 AM
Marco

I have the app registered with MS in Azure Active Directory (hence its client ID and client secret), however that error message you got said at the bottom: "AADSTS70001: Application with identifier '9e642308-e5f1-40d6-a476-e761cf97ed28' was not found in the directory 28it.com.au" (you had the same issue with the Office365Interface I think). That "Identifier" the correct client ID... hmm... Marco, are you running under "localhost" or under some 28it.com.au address? That might be the issue. I think I may need to write a thread or a blog post about this, but for now I will just say that these apps need to run under "localhost" (except for stupid MailChimp, which needs to run under 127.0.0.1, which is of course the IP address of localhost) because that is the registered callback address they have: "http://localhost/{AppName}/OAuth2/Callback.html" (AppName being OAuth2, or Office365Interface, or WebOrderMail).

These are only samples. For real-world deployment you would require a server hostname rather than localhost, but then that really ought to support HTTPS to be remotely secure, which would involve having a server certificate. Then the registered callback (both registered with the provider - MS in this case - and in the OAuth2 object in your code) would be something like "https://yourServer.yourDomain.com/yourApp/OAuth2/Callback.html".

Mike

Marco
30-Sep-2015, 05:02 PM
Hi Mike,
Am using localhost from my dev. computer.

Mike Peat
1-Oct-2015, 02:50 AM
Marco

Then I don't understand how 28it.com.au is getting into the error message. :(

Any ideas?

Mike

Marco
1-Oct-2015, 07:16 AM
My login name is marco@28it.com.au
So it would be the domain of my office 365 business account.

Mike Peat
1-Oct-2015, 10:29 AM
Marco

I'm out of ideas, so am sending you my login credentials to try with.

Mike