-
Notifications
You must be signed in to change notification settings - Fork 78
Open
Description
自己尝试之后找到的办法
Microsoft Azure
-> Manage Azure Active Directory
-> App registrations
-> new registration
需要替换的就是 /utils/static.py 中 Application (client) ID, Redirect URIs, Client Secret 三个参数,
Client ID 在 App overview 中查看; 在 Certificates & secrets -> new client secret ,创建了client secret
下面是 redirect uri 获取,注册好app之后,
- Redirect URIs -> Add a platform -> web application -> 填入 redirect URI
点Web app之后找到一个 quick start -> python -> Step 2 download the code sample,解压后是一个简单的 flask 服务
在服务器后台挂起服务 nohup python app.py &
如果在自己 pc/mac 上启动 onedrivecmd 和flask服务,redirect URI 是http://localhost:5000/getAToken
如果在服务器上,redirect URI 是https://ip:5000/getAToken,ip是服务器ip,如果服务器需要转发还得nginx转发到外网ip,注意是https不是http
如果端口被占用,需要修改端口,那么app.py修改最后一行app.run(port=8090),这里我设置端口8090,可以是其他没有占用端口 - 修改
onedrivecmd/utils/static.py中 client_id_normal ,client_secret_normal, redirect_uri
conda env list 查看虚拟环境安装地址,cd 虚拟环境文件夹, 然后用find ./ -name onedrivecmd - 修改 onedrivecmd 和 onedrivesdk 源码
a. 找到源码位置find ./ -name onedrivesdk
b. 发现由于onedrivesdk发送参数应该是string导致了错误,需要修改 onedrivesdk/auth_provider.py 第194行添上
params = "client_id=" + str(self.client_id) + '&redirect_uri=' + str(redirect_uri) +'&client_secret=' + str(client_secret) + '&code=' + str(code) +'&grant_type=authorization_code'然后根据作者的 onedrivecmd init ……就可以使用了
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels