【问题标题】:Azure Active directory return 403 as Access deniedAzure Active Directory 返回 403 作为访问被拒绝
【发布时间】:2022-06-14 19:04:34
【问题描述】:

我是新来使用这种类型的尝试通过点击 python 烧瓶服务器在我的组织中获取用户详细信息 网址:https://graph.microsoft.com/v1.0/me/ 请求标头: “内容类型”:“应用程序/json”,“授权”:accessToken 回应:

访问被拒绝

您请求的页面已被屏蔽

请问有什么建议吗?

从图形 URL 中,能够从 python 代码库获得响应,我们得到了拒绝访问。 python中的方法: def get_user_details_(access_token: str): url = "https://graph.microsoft.com/v1.0/me" headers = {'Content-Type': "应用程序/json", “授权”:access_token } 响应 = requests.get(url, headers=headers, verify=False) 打印(“响应****”,response.text) response = response.json() if response else {} 返回响应

enter image description here

【问题讨论】:

  • 请提供足够的代码,以便其他人更好地理解或重现问题。

标签: python azure accessibility graph-explorer


【解决方案1】:

要解决上述问题,我们可以按照以下解决方法;

  • 确保您的应用程序具有以下权限,以便在调用 API 时能够读取并提供所需的结果。

输出结果供参考:-

如需完整设置,请参考@Ephraim Mwai 撰写的此BLOG|Querying Microsoft Graph API with Python

【讨论】:

    猜你喜欢
    • 2018-06-26
    • 1970-01-01
    • 1970-01-01
    • 2018-08-18
    • 1970-01-01
    • 2015-09-07
    • 1970-01-01
    • 2013-11-14
    • 2018-04-23
    相关资源
    最近更新 更多