![](/img/trans.png)
[英]Authorization Access denied while accessing Azure Active Directory
[英]Azure Active directory return 403 as Access denied
我是新来使用这种类型的尝试通过点击 URL 来获取我的组织中的用户详细信息: https ://graph.microsoft.com/v1.0/me/ 请求标头:'Content-Type' :“应用程序/json”,“授权”:accessToken 响应:
您请求的页面已被阻止
请问有什么建议吗?从图 URL 中,能够从 python 代码库获得响应,我们得到了拒绝访问。 python中的方法:
enter code here
def get_user_details_(access_token: str): url = "https://graph.microsoft.com/v1.0/me" headers = {'Content-Type': "application/json", 'Authorization': access_token } response = requests.get(url, headers=headers, verify=False) print("response **** ", response.text) response = response.json() if response else {} return response
要解决上述问题,我们可以按照以下解决方法;
输出结果供参考:-
有关完整设置,请参考@Ephraim Mwai的这篇博客|Querying Microsoft Graph API with Python 。
我找到了答案。 它与代理有关。 我们需要向请求对象添加代理详细信息。
proxyDict = { "http": "http 代理地址", "https": "https 代理地址" }
response = requests.request('GET', url, headers=headers, proxies=proxyDict , verify=False)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.