【问题标题】:How to solve 'PII is hidden' for node/express如何解决节点/快递的“PII 被隐藏”
【发布时间】:2021-06-14 14:22:21
【问题描述】:

我有一个使用 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 保护。然后我得到错误。显然有些东西没有正确配置。只是不知道调试什么或如何调试。

【问题讨论】:

  • 如何设置scope
  • 嗨,我编辑了答案。

标签: node.js azure azure-active-directory


【解决方案1】:

我之前回答过类似的问题,这通常是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"
  ]
};

【讨论】:

  • 嘿,我已经从 Microsoft Graph 检索到了一个访问令牌。我的计划是使用它来访问我的 API。
  • @KimR 你想调用哪个 api?你想调用ms graph api吗?你试过我的答案吗?
  • 感谢卡尔的帮助。我已经编辑了我的问题。
  • @KimR 你得到的是ms graph api的token,你不能用它来调用自定义api。
  • 不要介意关于 MS 图的部分。我说错了。我实际上使用令牌来访问 MS 图
猜你喜欢
  • 1970-01-01
  • 2020-04-22
  • 1970-01-01
  • 2018-11-08
  • 1970-01-01
  • 2019-09-15
  • 1970-01-01
  • 2012-12-30
  • 2012-05-12
相关资源
最近更新 更多