adal.jsを統合してEWS APIにアクセスしようとしています。私たちのアプリはAngular 1.5.8を使って実装されています。ログインに成功すると、id_tokenでアプリのホームページにリダイレクトされます。 MSからの次のリンクによると: https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-protocols-implicit 私はEWS APIと話すためにid_tokenの代わりにaccess_tokenを使用すると仮定します。暗黙の許可フローにaccess_tokenは必要ありませんか?
これで、ユーザーは1ページのアプリケーションに署名したので、Azure ADによって保護されたWeb API(Microsoft Graphなど)を呼び出すためのアクセストークンを取得できます。
有効なクライアントIDを使用してadalAuthenticationService.acquireToken
を使用しようとしています。しかし、トークンはid_token
と同じです。私たちが間違っていたことはありますか?
\t // configure our routes
\t testApp.config(function($httpProvider, $locationProvider, $routeProvider, adalAuthenticationServiceProvider) {
\t \t $locationProvider.html5Mode({
\t \t enabled: true,
\t \t requireBase: false
\t \t }).hashPrefix('!');
\t \t $routeProvider
\t \t \t // route for the home page
\t \t \t .when('/', {
\t \t \t \t templateUrl : 'pages/home.html',
\t \t \t \t controller : 'mainController',
\t \t \t \t requireADLogin: true
\t \t \t })
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);
\t \t
\t });
\t // create the controller and inject Angular's $scope
\t testApp.controller('mainController', function($scope, adalAuthenticationService) {
\t \t // create a message to display in our view
\t \t $scope.message = 'Everyone come and see how good I look!';
\t \t $scope.getAccessToken = getAccessToken;
\t \t function getAccessToken() {
\t \t \t adalAuthenticationService.acquireToken('TEST_CLIENT_ID', (newToken) => {
\t \t \t \t console.log('Access token aquired: ' + newToken);
\t \t \t }, (error) => {
\t \t \t \t console.log('ERROR with token: ' + angular.toJson(error, true));
\t \t \t });
\t \t };
\t });
お返事ありがとう@RasmusW。私は本当にこのリソースのURLパラメータについて非常に混乱しています。設定オブジェクトからloginResourceを指定する必要があると私には思われます。それ以外の場合は、AuthenticationContextの初期化処理中にclientIdがデフォルトになります。 https://outlook.office.comにそのリソースのURLを常にハードコードする必要があることを前提としていますか?ありがとう – user3025587
リソースURLはアクセストークンからアクセスを許可するものです。 Azure ADグラフAPIにアクセスしたい場合は、graph.windows.netなどとなります。EWSではoutlook.office.comです。 – RasmusW
ありがとうございます。それはかなり有用な情報です。最後の質問の1つは、EWSが管理するAPIにアクセスするために、URLを使用する必要があるオフィス365(https://outlook.office365.com/EWS/Exchange.asmx)です。その場合、私たちのリソースURLは:https://outlook.office365.comですか?ありがとう – user3025587