I\'m trying to authenticate a HTML app against an Azure Mobile Service app.
Both apps use AAD as authentication backend, so both apps have an app
You can use the AzureMobileServices client script to do a login with an already obtained token:
You need to include the follwing script: https://ajax.aspnetcdn.com/ajax/mobileservices/MobileServices.Web-1.2.8.min.js
Then after you obtained the token with ADAL.JS you can use it to login and obtain a Mobile Service Authentication Token:
var appUrl = 'https://foobar.azure-mobile.net'
, appKey = 'zumo key' // found on the dashboard of the mobile service
, client = new WindowsAzure.MobileServiceClient(appUrl, appKey);
// ...
var token = this.getAADToken(ZUMOAuthenticationProvider.Config().url);
client
.login('aad', { 'access_token': token })
.then(function() {
// client.currentUser.mobileServiceAuthenticationToken
});
This token then needs to be included in succeeding mobile service API requests:
var config = {
headers: {
'X-ZUMO-AUTH': client.currentUser.mobileServiceAuthenticationToken
}
}
$http
.get(appUrl + '/some/path', config)
.then(function (r) {
console.log(r);
});