Question

I would like to know if is possible read/write data from/to azure active directory ad by Javascript. I read that there are REST services on Azure but the main issue is generate the token to talk with that and it seems that JS library doesn't exist for that.

Was it helpful?

Solution

Yes, there is such service. It is called Windows Azure Active Directory Graph API.

It is REST based and one can authenticate via OAuth to use it. Please note that currently the Resource Owner Password Flow is not supported in WAAD, but the regular token based authentication is. What you will need is:

  • Get an overview of the Graph API here.
  • Create an application inside Azure AD so that you get an application credentials to use with the Graph API (tutorial here)
  • Find some good JavaScript library that can generate OAuth headers (you can start here).

UPDATE

Actually you can't query the graph API from JavaScript as there is not CORS support for it. The only CORS supported services are Azure Mobile Services and Azure Storage. Which makes the use of a middle tier "service proxy" inevitable. The only "JavaScript" stuff that will work with WAAD (Windows Azure AD) is the developer preview of ADAL for Windows Store.

As for where to keep OAuth key and secret everyone shall use their imagination. I never mentioned neither suggested to keep these on the client.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top