python-3.x - 身份验证 OneDrive Python API

标签 python-3.x sdk oauth-2.0 onedrive

我正在尝试将我的 OneDrive 与 Python 一起用于业务。

我已经安装了 onedrivesdk,现在我正在验证我的 OneDrive

提供的代码如下

import onedrivesdk

redirect_uri = 'http://localhost:8080/'
client_secret = 'your_client_secret'
client_id='your_client_id'
api_base_url='https://api.onedrive.com/v1.0/'
scopes=['wl.signin', 'wl.offline_access', 'onedrive.readwrite']

http_provider = onedrivesdk.HttpProvider()
auth_provider = onedrivesdk.AuthProvider(
http_provider=http_provider,
client_id=client_id,
scopes=scopes)

client = onedrivesdk.OneDriveClient(api_base_url, auth_provider, http_provider)
auth_url = client.auth_provider.get_auth_url(redirect_uri)

我不确定我应该提供什么 client_secret 和 client_id 才能访问我的 OneDrive

我将感谢有关从何处获取上述参数的帮助。

最佳答案

client_secretclient_id是使用 OAuth2 所需的两个必需参数,这是用于授权的行业标准协议(protocol)。

查看以下链接,了解如何获取与 OneDrive 访问相关的这些信息:

https://dev.onedrive.com/auth/msa_oauth.htm

Get Access Token with OneDrive API

您需要通过以下链接注册您的应用程序:
https://dev.onedrive.com/app-registration.htm

之后,您的应用程序将收到一些请求,并使用有效的用户凭据访问 OneDrive 帐户。

我希望它有所帮助。

关于python-3.x - 身份验证 OneDrive Python API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45112152/

相关文章:

python-3.x - 实时更新 Python 中的可执行子进程控制台输出

php - Paypal SDK 支付 - 无法捕获异常并接收 http 400

ios - 在 iOS 应用程序中登录 Facebook

security - 私有(private)应用程序的 OAuth2 流程和最佳实践

php - 适用于 PHP 的 Google Identity Toolkit API 返回 INVALID_CLIENT

Python PIL int 对象不可下标

python-3.x - 在 PyCharm 中重构字符串连接以格式化

java - 保护 Google Cloud Endpoints 免受未经授权用户的侵害

python - 设置一个字典中包含另一字典路径的值

java - Windows Azure cspack.exe 是开源的吗?