Office365 API:令牌具有无效签名

时间:2016-08-02 20:27:35

标签: office365 office365api office365-apps office365-restapi office365connectors

我目前正在尝试使用从前端通过adaljs获取的访问令牌从php后端查询Office365 API。来自前端的API调用完美无缺。但是,api调用后端使用相同的令牌,Postman失败并显示错误:2000000;reason="The token has an invalid signature.";error_category="invalid_signature"

前端(工作)示例:

$http.get("https://outlook.office365.com/api/v1.0/me/calendarview?StartDateTime=2016-08-02T00:00:00Z&EndDateTime=2016-08-02T23:59:00Z") //working
            .then(function (response) {
                $log.debug('HTTP request to Calendar API returned successfully.');
                console.log(response);
            }, function (error) {
                $log.error('HTTP request to Calendar API failed.');
                console.log(error);
            });

获取Office365 API(不是我的客户端应用程序)的令牌并存储在db:

adalAuthenticationService.acquireToken('https://outlook.office365.com').then(function(refreshToken) {

            var data = {

                code: refreshToken,
                email: email

            };

            console.log(refreshToken);

            Office365.createIntegration('office365', data)

                .then(function() {

                    console.log("link created");
                    $scope.loading = false;


                }, function(error) {

                    console.error(error);
                    $scope.loading = false;

                })

        }, function(err) {

            console.error(err);

        });

JWT也设置了aud: "https://outlook.office365.com",

1 个答案:

答案 0 :(得分:1)

我觉得很傻,但是我的访问令牌没有在其他代码中更新到数据库(它看起来像,但它不是)。因此访问令牌无效,因此错误。如果您发现此情况,请确保您的访问令牌有效/最新令牌!

相关问题