Angularjs adal idtoken未在会话存储中反映
我正在使用adal.angular库,该库在 我的app.js看起来像这样Angularjs adal idtoken未在会话存储中反映,angularjs,azure,adal,adal.js,Angularjs,Azure,Adal,Adal.js,我正在使用adal.angular库,该库在 我的app.js看起来像这样 app.ui = angular.module("app.ui", ["ui.router", "ngCookies", "app.global", "app.business", "ngSanitize", "AdalAngular"]), app.ui.config(["$stateProvider", "$urlRouterProvider", "$controllerProvider", "$provide",
app.ui = angular.module("app.ui", ["ui.router", "ngCookies", "app.global", "app.business", "ngSanitize", "AdalAngular"]),
app.ui.config(["$stateProvider", "$urlRouterProvider", "$controllerProvider", "$provide", "$compileProvider", "$filterProvider", "$httpProvider", "adalAuthenticationServiceProvider",
function(a, b, c, d, e, f, $httpProvider, adalProvider) {
try {
var g = props.config;
console.log(location.href);
if (app.ui.register = {
controller: c.register,
directive: e.directive,
filter: f.register,
factory: d.factory,
service: d.service,
value: d.value
}, g.routes) {
var endpoints = {};
adalProvider.init(
{
tenant: "tenent",
clientId: "clientId",
redirectUri: "https://localhost:8443/#/login",
endpoints: endpoints
},
$httpProvider // pass http provider to inject request interceptor to attach tokens
);
var h = null,
i = {
js: [],
css: []
};
h = g.routes, angular.forEach(h, function(b) {
var c = b.route,
d = b.controller,
e = b.templateUrl,
f = b.title;
i = {
js: [],
css: []
}, b.dependency && (b.dependency.js && (Array.isArray(b.dependency.js) ? angular.forEach(b.dependency.js, function(a) {
i.js.push(a)
}) : i.js.push(b.dependency.js)), b.dependency.css && (Array.isArray(b.dependency.css) ? angular.forEach(b.dependency.css, function(a) {
i.css.push(a)
}) : i.css.push(b.dependency.css))), a.state(b.state, {
url: c,
controller: d,
templateUrl: e,
title: f,
dependency: i,
resolve: dependencyLoader()
})
}),
b.otherwise(g.defaultRoute),
window.location.hash && (window.location.hash = g.defaultRoute);
}
console.log(window.location.hash);
} catch (j) {
console.log(j);
}
}]);
我的defaultRoute是登录控制器,控制器js如下所示
app.ui.register.controller("loginController", ["$scope", "adalAuthenticationService", a])
function a($scope, adalAuthenticationService) {
$scope.submit = function() {
adalAuthenticationService.login();
}
}
我可以看到,单击Submit按钮的URL会获取我的用户名和密码,并返回到URL,URI为
但是我在会话存储中看不到id_令牌。下面列出了此URL返回到本地主机后在会话存储中看到的所有内容
Key - Value
adal.error - '',
adal.error.description - '',
adal.login.error - '',
adal.login.request - https://localhost:8443/#/login,
adal.nonce.idtoken - asdasd23-asd2-as34-asd2-asd23423qsdas,
adal.state.login - 123asdasd-asd2-asd2-as22-asd123dfasd,
我不确定我做错了什么,因为我没有在会话存储中保存adal.idtoken。请参考此代码示例:,它在我这边有效,您的浏览器是什么,会话存储不适用于IE中的localhost。我使用了Chrome并设法解决问题,删除了代码窗口。location.hash&&(window.location.hash=g.defaultRoute);为我工作。感谢您的回复。