You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Kristy Overton edited this page Feb 22, 2016
·
4 revisions
It took me a long time to sort this out, so if you're having trouble, maybe it will help.
If you want to use ADAL both locally (login/logout) and to authenticate an external API, you'll need a different token for each (if you parse them, you'll see the "audience" change to reflect which thing you're trying to access). You can ensure the tokens get set correctly thusly:
$locationProvider.html5Mode(true).hashPrefix('!');
var endpoints = {
"https://www.whatever.com/myApi": "https://whatever.onmicrosoft.com/MyApi"
}
adalProvider.init(
{
instance: 'https://login.microsoftonline.com/',
tenant: 'whatever.onmicrosoft.com',
clientId: '{clientId of mysite.com}',
endpoints: endpoints,
loginResource: '{same as clientId - probably don't NEED this, but it clarifies things}',
redirectUri: "http://www.mysite.com",
resource: "https://whatever.onmicrosoft.com/MyApi",
cacheLocation: 'localStorage' // enable this for IE, as sessionStorage does not work for localhost.`
},
$httpProvider`
);