Ich entwickle eine Beispielanwendung, die Azure Ad-Authentifizierungsdienste verwendet. Ich verwende adal-angular, adal js zur Validierung, ich kann mich erfolgreich anmelden, aber danach kann ich nicht interpretieren das erhaltene Token, Kann mir bitte jemand helfen, zu finden, was ich vermisse?azure AD adalAuthenticationService kann das Token nicht lesen
Code-Snippet:
var app = angular.module("myApp", ["ngRoute","AdalAngular"]);
app.config(["$httpProvider","adalAuthenticationServiceProvider",function($httpProvider,adalProvider) {
/*var endpoints ={
"http://localhost:8080/index.jsp/":"https://thirumalaivstgit.onmicrosoft.com/sampangular"
};*/
adalProvider.init(
{
instance: "https://login.microsoftonline.com/",
tenant: "thirumalaivstgit.onmicrosoft.com",
clientId: "f1f7aafc-8901-4755-bb66-a46eae527e33",
redirectUri: 'http://localhost:8080/index.jsp'
},$httpProvider);
}]);
app.controller("getvaluecontroller",["$scope","$http","adalAuthenticationService",function($scope,$http,adalService){
$scope.appname="dfsfgggsgsdg";
$scope.claims = [];
$scope.login=function(){
var loginvalue=adalService.login();
console.log(loginvalue);
}
$scope.userSignedIn=function(err, token)
{
console.log('userSignedIn called');
if (!err) {
console.log("token: " + token);
}
else {
console.error("error: " + err);
}
}
$scope.logout=function(){
adalService.logOut();
}
$scope.afterlogin=function()
{
console.log("afterlogin::" +adalService);
adalService.acquireToken("https://thirumalaivstgit.onmicrosoft.com",function(errorDesc,token,error){
console.log("afterlogin error");
console.log(errorDesc);
console.log(token);
console.log(error);
});
console.log("afterlogin000000");
}
$scope.getvalue=function()
{
console.log("asdfasdfsdfg");
console.log("getvalue::"+adalService.userInfo.profile);
for (var property in adalService.userInfo.profile) {
if (adalService.userInfo.profile.hasOwnProperty(property)) {
$scope.claims.push({
key: property,
value: adalService.userInfo.profile[property],
});
}
}
console.log("getvalue");
}
}])