我正在使用 office365-rest-python-client 以编程方式访问 Office365 在线中的 SharePoint 网站。
我要加入的应用程序只是一个将在后端运行的 Python 脚本 为此,我访问了 https://entra.microsoft.com/ 管理中心并执行了以下操作:
然后使用office365-rest-python-client,我使用应用程序clientId和SecretValue发送请求以添加页面
请求失败,并在 Microsoft Office365 Entra 的审核日志中显示以下错误:
Based on the information you provided we have identified following issue and recommend taking the action to resolve the issue.
Error Code: 65001
Message: The user or administrator has not consented to use the application with ID ''(). Send an interactive authorization request for this user and resource.
在 Microsoft 文档中更深入地了解此错误,它指出
AADSTS65001 DelegationDoesNotExist - The user or administrator has not consented to use the application with ID X. Send an interactive authorization request for this user and resource.
客户端显示
POST /sites/security/_api/contextInfo
和
POST /sites/security/_api/sitePages/pages
回归
401 client error “Unauthorized for url : https://my-sharepoint/sites/security/_api/sitePages/pages
这个问题的原因可能是什么??
提前致谢
我使用了证书身份验证,它按照指定的方式工作https://pypi.org/project/Office365-REST-Python-Client/
下
文档:
[Granting access via Azure AD App-Only][1]
[wiki][1]
示例:connect_with_client_certificate.py