Azure Active Directory Access Token from Id Token -
i'm using webview build mobile app. means we're writing in html/js hosted locally (file system), receiving data apis. using adal.js
received id_token
, trying use authentication token, described here results in 401 unauthorized
.
is configuration missing?
request:
post https://myams.azure-mobile.net/login/aad http/1.1 host: myams.azure-mobile.net connection: keep-alive content-length: 1264 pragma: no-cache cache-control: no-cache accept: application/json, */*; q=0.01 origin: file:// authorization: bearer ey...ww user-agent: mozilla/5.0 (linux; android 4.4.4; en-us; nexus 4 build/jop40d) applewebkit/537.36 (khtml, gecko) chrome/42.0.2307.2 mobile safari/537.36 content-type: application/json accept-encoding: gzip, deflate accept-language: en-us,en;q=0.8 access_token=ey...ww
response
http/1.1 401 unauthorized content-length: 0 server: microsoft-iis/8.0 www-authenticate: basic realm="service" access-control-allow-origin: * x-powered-by: asp.net date: mon, 27 jul 2015 10:47:45 gmt
this audience mismatch. adal.js obtains id_token via implicit flow, requires identify target resource clientid (a guid). not in mobile services team, assume expect in incoming token app id uri instead. need access token in order audience other clientid. asmple in https://github.com/azureadsamples/singlepageapp-webapi-angularjs-dotnet shows how. disclaimer: adal.js not designed used in web view. might find use difficult in scenario. cases, provide cordova plugin: http://www.cloudidentity.com/blog/2015/04/06/adal-plugin-for-apache-cordova-deep-dive/
Comments
Post a Comment