访问令牌的'Invalid Signature'错误(azure活动目录/ msal js)

问题描述 投票:0回答:1

我使用MSAL JS进行用户身份验证,然后调用AccessToken的AcquisitionTokenPopup(scopes)。

我正在获取访问令牌,但不能使用它,因为它显示Invalid Signature。(也在jwt.io中检查-同样的错误)

在论坛上,我发现这是由于Graph添加了随机数。解决办法是什么?请帮助。

下面是代码。

tenantConfig = {
    scopes: ["directory.read.all"]
};

this.clientApplication.acquireTokenSilent(this.tenantConfig.scopes).then(函数(accessToken){

            },
            function (error) {
                console.log(error);
                this.clientApplication
                    .acquireTokenPopup(this.tenantConfig.scopes)
                    .then(
                        function (accessToken) {

                            console.log("access token   " + accessToken);
                        },
                        function (error) {
                            alert(error);
                        }
                    );
            }
        );
azure-active-directory msal.js
1个回答
0
投票

这没关系。只需将jwt.io中的algorithm更改为HS256,即可验证签名。

enter image description here

访问令牌应该可以。只要确保您已在Azure门户上添加Diretory.Read.All权限并获得管理员同意即可。

enter image description here'

参考:

Call Graph API from a JavaScript Single Page Application using msal.js

© www.soinside.com 2019 - 2024. All rights reserved.