【问题标题】:Azure AD validation with python使用 python 进行 Azure AD 验证
【发布时间】:2019-10-02 10:09:50
【问题描述】:

我在理解 Graph API 文档时遇到了一些困难。 我想通过内部应用程序检查用户当前是否已登录。

该应用具有以下权限: - 应用:读取目录数据 - 委托:读取目录数据 - 委托:阅读所有组 - 委托:登录并阅读用户资料

令牌是在 https://login.microsoftonline.com/{directoryId}/oauth2/token 情况如下:

理论

文档说 获取 /auditLogs/signIns/{id} (https://docs.microsoft.com/en-us/graph/api/signin-get)

并举个例子: https://graph.microsoft.com/v1.0/auditLogs/signIns/{id} (https://docs.microsoft.com/en-us/graph/api/signin-get?view=graph-rest-1.0&viewFallbackFrom=graph-rest-1.6#tabpanel_CeZOj-G++Q_http)

但是我们使用的 API 请求看起来像 https://graph.windows.net/{directoryId}/...

问题

当我请求时 https://graph.windows.net/{directoryId}/auditLogs/signIns/{objectIdOfUser} 我得到 [Request_ResourceNotFound] “未找到段 'auditLogs' 的资源。”

当我请求时(如文档所示) https://graph.windows.net/auditLogs/signIns/{objectIdOfUser} 我得到 [Request_BadRequest] "请求 url 中的域名无效。"

当我请求时(如文档示例所示) https://graph.microsoft.com/v1.0/auditLogs/signIns/{id} 我得到 [InvalidAuthenticationToken] “访问令牌验证失败。无效的受众。”

您能否为我们提供一个工作示例(带有纯 URL),说明如何为给定用户获取“objectId”的“signinStatus”资源?

【问题讨论】:

    标签: python azure-active-directory


    【解决方案1】:

    听起来你已经获得了 Azure AD Graph API 的令牌,它与 Microsoft Graph API 不同。

    确保您使用 resource https://graph.microsoft.com 请求令牌。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-03-13
      • 1970-01-01
      • 2019-06-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多