首页 > 解决方案 > 如何解决节点/快递的“PII 被隐藏”

问题描述

我有一个使用 azure 上托管的 express 的 node-api。我使用 Azure AD 进行身份验证。当我尝试使用邮递员进行调试时,我得到这样的错误响应

 "message": "IDX10511: Signature validation failed. Keys tried: '[PII is hidden]'. \nkid: '[PII is hidden]'. \nExceptions caught:\n '[PII is hidden]'.\ntoken: '[PII is hidden]'."

错误本身是我可以弄清楚的(希望如此),但我需要能够显示 PII,我该如何管理?

评论后编辑:

好的,所以我会尝试解释。

  1. 我有一个使用 msal 和 loginpopup(Authsettings) 的角度前端。

    export const OAuthSettings = {
      appId: '*************', 
      redirectUri: 'http://localhost:4200',
      authority : "https://login.microsoftonline.com/***tenant***/",
      scopes: [
        "user.read",
        "openid",
        "profile",
        "mailboxsettings.read",
        "calendars.readwrite"
      ]
    };
    
  2. 使用我的企业帐户登录后,我得到了访问令牌。

  3. 现在我想调用我的 api,它(应该)受 azure ad 保护。然后我得到错误。显然有些东西没有正确配置。只是不知道要调试什么或如何调试。

标签: node.jsazureazure-active-directory

解决方案


我以前回答过类似的问题,这通常是由scope.

您需要公开受 Azure 保护的node-api 应用程序的 api 。然后将其更改scope为:{your api application client id}/{scope name}

export const OAuthSettings = {
  appId: '*************', 
  redirectUri: 'http://localhost:4200',
  authority : "https://login.microsoftonline.com/***tenant***/",
  scopes: [
    "{your api application client id}/user.read"
  ]
};

推荐阅读