You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

通过Microsoft Graph API获取OneDrive for Business站点ID时遇SSL证书验证失败问题求助

通过Microsoft Graph API获取OneDrive for Business站点ID时遇SSL证书验证失败问题求助

我现在正卡在通过Microsoft Graph API获取OneDrive链接对应的站点ID这件事上,想请大家帮忙看看问题出在哪。

我的OneDrive链接是:https://sharedspace-my.sharepoint.com/:f:/r/personal/naruto/Documents/Shared%20Folders/hinata?csf=1&web=1&e=M3GWjd

我从这个链接里提取了以下信息:

  • HOST = sharedspace-my.sharepoint.com
  • SITE_URL = /personal/naruto/Documents/Shared%20Folders/hinata

目前我已经成功获取到了访问令牌(access token),权限也确认过是可访问的,但当我尝试调用API获取站点ID时,却遇到了这个SSL证书验证错误:

ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1108)

下面是我使用的代码片段:

auth_url = f'https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token'
data = {
    'client_id': client_id,
    'scope': 'files.readwrite.all',
    'username': username,
    'password': password,
    'grant_type': 'password',
    'response_type': 'code',
    'client_secret': client_secret
}
# 后续调用获取站点ID的API代码(比如GET /sites/{host}:/{site-url})

有没有朋友遇到过类似的问题?或者能给我一些排查的方向?

备注:内容来源于stack exchange,提问作者JSVJ

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.15 12:03:06