0
votes

I am using adal service in angular 5 project for Microsoft auth2.0 authentication. I am getting id_token by

this.adalService.getCachedToken(this.secretService.adalConfig.clientId);

But I need Accesstoken for further token verification.

I tried https://graph.microsoft.com/v1.0/me api but got Access token validation failure error

1

1 Answers

0
votes

Should be

this.adalService.acquireToken("https://graph.microsoft.com", (error, token) => {
    // token has the Access Token
});

If you use the $httpProvider and requireADLogin, then you should automagically have an access token requested and attached for that destination:

$routeProvider.when("/forecast", {
    controller: "forecastController",
    templateUrl: "/views/forecast.html",
    requireADLogin: true
});

See https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-devquickstarts-angular