我正在尝试将我的 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_secret
和 client_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/