ng-cordova-oauth icon indicating copy to clipboard operation
ng-cordova-oauth copied to clipboard

ng-cordova-oauth with Office 365

Open nhat-tong opened this issue 9 years ago • 6 comments

Hi nraboy,

I'm interested in your work. It's really cool.

Now, I work with Office 365 API and had the problems when the redirection url returned. On mobile, it don't know how to resolve it (for display pop-up prompt) (link: https://github.com/auth0/auth0-ionic/issues/8)

I tried to use auth-dialog with an InAppBrowser custom for resolve it but it not work correctly.

So, can I use ng-cordova-oauth for doing the authentication with Office 365 ?

Thanks so much,

Nhat

nhat-tong avatar May 28 '15 14:05 nhat-tong

Is Office 365 the same as Windows Live? If yes, then it is currently supported.

If it is not the same, please find me the Oauth documentation for Office 365 and add it to this comment. Then I'll do my own research after that.

Thanks,

nraboy avatar May 29 '15 20:05 nraboy

Hi, here is a node module that implements OAuth with Office365. I think it may be different than Windows Live, but I get confused with all the microsoft product names.

https://github.com/QuePort/passport-azure-oauth

Basically you need to register an App in Azure Active Directory (which is free).

amit777 avatar Aug 25 '15 16:08 amit777

Hi, I can see this post was over 3 months ago now but just encase you are still stuck. About a week ago I implemented azureAD as a function to this repo, it currently is in development branch. I was facing the same problems as you when first starting out. If this doesn't help you let me know and I'm sure we can get a wrapper for office365 as well.

gregmcpugh avatar Aug 25 '15 17:08 gregmcpugh

Oh, very cool. Thanks! I'll check out the Dev branch and let you know how it goes. Great project btw

amit777 avatar Aug 25 '15 20:08 amit777

Hi, I just wanted to check in on this. I've been trying the azuread provider, and I'm close, however I'm getting the follow error. (I have SSO working to Google, Salesforce, and AzureAD on the web, and working with Google and Salesforce with ngCordovaOauth). I mention this because I'm fairly certain my ClientId, Tenant ID is correct. Though I'm not sure about the resource URL below.

My code looks like this (using the current version of the lib 0.2.3):

$cordovaOauth.azureAD('CLIENT_ID', 'TENANT_ID', 'https://api.office.com/discovery/')

I added more debug logging to the library and found this error:

{"error":"invalid_request","error_description":"AADSTS90014: The request body must contain the following parameter: 'client_secret or client_assertion'.\r\nTrace ID: 064559d7-2259-4621-9425-e41a76dccc39\r\nCorrelation ID: 4869e9d7-6e28-4530-98a9-524b65011d5c\r\nTimestamp: 2016-03-17 21:20:15Z","error_codes":[90014],"timestamp":"2016-03-17 21:20:15Z","trace_id":"06455967-2259-4621-9425-e41a76dccc39","correlation_id":"4869e9d7-6e28-4730-98a9-524b65011d5c"}

amit777 avatar Mar 17 '16 21:03 amit777

I changed the resource URL to match my AppID inside my application, and I now get this error instead..

"error":"invalid_request","error_description":"AADSTS90014: The request body must contain the following parameter: 'client_secret or client_assertion'.\r\nTrace ID: 498a27e7-351f-48e8-807a-c1d72417a6fe\r\nCorrelation ID: 0a440b57-d1f9-4f65-9938-d19e6a1d59df\r\nTimestamp: 2016-03-17

Do you know if the ADAL library and this library are helpful? In the docs, this example requires us to create a "Native Application" in AzureAD rarthre than a webapplication..

https://azure.microsoft.com/en-us/documentation/articles/active-directory-devquickstarts-cordova/

amit777 avatar Mar 17 '16 23:03 amit777