access_token 隐式授权流程不需要?
access_token not required for Implicit Grant Flow?
我们正在尝试集成 adal.js 以访问 EWS API,我们的应用程序是使用 Angular 1.5.8 实现的。登录成功后,重定向回应用首页id_token。根据来自 MS 的以下 link:
https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-protocols-implicit
我们假设使用 access_token 而不是 id_token 与 EWS API 对话。
Now that you've signed the user into your single page app, you can get access tokens for calling web APIs secured by Azure AD, such as the Microsoft Graph.
所以我们正在尝试使用 adalAuthenticationService.acquireToken
和有效的 clientId。但是我们拿到的token和id_token
是一样的。我们做错了什么吗?
// configure our routes
testApp.config(function($httpProvider, $locationProvider, $routeProvider, adalAuthenticationServiceProvider) {
$locationProvider.html5Mode({
enabled: true,
requireBase: false
}).hashPrefix('!');
$routeProvider
// route for the home page
.when('/', {
templateUrl : 'pages/home.html',
controller : 'mainController',
requireADLogin: true
})
adalAuthenticationServiceProvider.init({
// clientId is the identifier assigned to your app by Azure Active Directory.
clientId: "TEST_CLIENT_ID",
cacheLocation: 'localStorage', // optional cache location default is sessionStorage
}, $httpProvider);
});
// create the controller and inject Angular's $scope
testApp.controller('mainController', function($scope, adalAuthenticationService) {
// create a message to display in our view
$scope.message = 'Everyone come and see how good I look!';
$scope.getAccessToken = getAccessToken;
function getAccessToken() {
adalAuthenticationService.acquireToken('TEST_CLIENT_ID', (newToken) => {
console.log('Access token aquired: ' + newToken);
}, (error) => {
console.log('ERROR with token: ' + angular.toJson(error, true));
});
};
});
代码似乎没有告诉 acquireToken
调用它需要哪个资源的令牌。你把它设置在其他地方吗?
否则,您应该将资源 URL“https://outlook.office365.com”作为资源参数添加到 acquireToken
调用。
我们正在尝试集成 adal.js 以访问 EWS API,我们的应用程序是使用 Angular 1.5.8 实现的。登录成功后,重定向回应用首页id_token。根据来自 MS 的以下 link: https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-protocols-implicit 我们假设使用 access_token 而不是 id_token 与 EWS API 对话。
Now that you've signed the user into your single page app, you can get access tokens for calling web APIs secured by Azure AD, such as the Microsoft Graph.
所以我们正在尝试使用 adalAuthenticationService.acquireToken
和有效的 clientId。但是我们拿到的token和id_token
是一样的。我们做错了什么吗?
// configure our routes
testApp.config(function($httpProvider, $locationProvider, $routeProvider, adalAuthenticationServiceProvider) {
$locationProvider.html5Mode({
enabled: true,
requireBase: false
}).hashPrefix('!');
$routeProvider
// route for the home page
.when('/', {
templateUrl : 'pages/home.html',
controller : 'mainController',
requireADLogin: true
})
adalAuthenticationServiceProvider.init({
// clientId is the identifier assigned to your app by Azure Active Directory.
clientId: "TEST_CLIENT_ID",
cacheLocation: 'localStorage', // optional cache location default is sessionStorage
}, $httpProvider);
});
// create the controller and inject Angular's $scope
testApp.controller('mainController', function($scope, adalAuthenticationService) {
// create a message to display in our view
$scope.message = 'Everyone come and see how good I look!';
$scope.getAccessToken = getAccessToken;
function getAccessToken() {
adalAuthenticationService.acquireToken('TEST_CLIENT_ID', (newToken) => {
console.log('Access token aquired: ' + newToken);
}, (error) => {
console.log('ERROR with token: ' + angular.toJson(error, true));
});
};
});
代码似乎没有告诉 acquireToken
调用它需要哪个资源的令牌。你把它设置在其他地方吗?
否则,您应该将资源 URL“https://outlook.office365.com”作为资源参数添加到 acquireToken
调用。