rclone 無管理員 Onedrive 使用
移植工程:http://github.com/nickfox-taterli/rclone
編譯好的版本: Linux(64位) / Windows(64位)
特別警告:SharePoint傳輸效率低於Graph API,如無必要,儘量使用標準API,並且不支援世紀互聯.
如何進行無管理員OneDrive繫結,首先無管理員OneDrive是不可以進行API授權的,但是依然有辦法獲取access_token,即可以進行對接.
無管理Office特徵,登入Office子號時會顯示管理圖示的,都是無管理狀態.
進入OneDrive頁面,開啟F12除錯工具,搜尋關鍵字RenderListData,可以找到driveAccessToken和driveUrl兩項,這是關鍵.
由於沒有API,配置檔案需要自己寫,比如我提取到的資訊如下.
.driveAccessToken: "access_token=eyJ0........D0" .driveUrl: "http://alumnibentley-my.sharepoint.com/_api/v2.0/drives/b!....-...."
我可以編輯配置檔案~/.config/rclone/rclone.conf新增一個欄位,比如我新增一個alumnibentley的欄位.
[alumnibentley] type = onedrive token = {"access_token":"eyJ0........D0","token_type":"Bearer","refresh_token":"","expiry":"2020-06-30T15:22:06.648584+08:00"} drive_id = b!....-.... noadmin = true tenant_url = http://alumnibentley-my.sharepoint.com/_api drive_type = business
注意expiry時間並不準確,你可以隨便寫個未來的時間,因為過期時間實際上並不確定,一旦過期,只能到網頁上重新獲取,然後就可以玩了~
重點!許可權不夠怎麼辦?
這裡是請求token的許可權,如果不夠,我們可以自己寫POST請求,也是一樣的,最高可以獲取到0x17FFFF(即1572863),每一位(Bit)代表一個一個許可權.
參考程式碼(Python)
import requests url = "http://alumnibentley-my.sharepoint.com/personal/admin_alumni_bentley_edu/_api/web/GetListUsingPath([email protected])/[email protected]='/personal/admin_alumni_bentley_edu/Documents'&TryNewExperienceSingle=TRUE" payload = '''{ "parameters": { "__metadata": { "type": "SP.RenderListDataParameters" }, "RenderOptions": 1572863, "AllowMultipleValueFilterForTaxonomyFields": true, "AddRequiredFields": true } }''' headers = { 'Accept': 'application/json;odata=verbose', 'Content-Type': 'application/json;odata=verbose', 'Cookie': 'rtFa=[RTFA]; FedAuth=[FEDAUTH]' } response = requests.post(url, headers=headers, data = payload) print(response.text)
測試:
目前測試主流上傳下載建立目錄同步功能是OK的,另外,世紀互聯不會產出access_token,只有變化較為多的FedAuth和rtFa,有需要的話,用這兩個引數也可以進行API操作.
「其他文章」
- Yocto 幾個常用映象差異 (以FSL官源為例)
- ZYNQ U-Boot 程式碼分析 Vivado SDK 載入除錯
- Debian切換到netplan管理網路
- 最簡單的方法入門CUDA
- Docker IPv6 – iptables 對映方法
- NDP代理模仿Routed Prefix功能
- QCOW2的幾種預分配規則建立時間對比
- 使用命令KVM小雞
- RK 純開原始碼構建
- TinyML ESP32 人檢測應用的移植和使用
- 建立並取得Mongodb Altas賬戶並取得連線字串
- 折騰4T只需5歐的Seedbox – 含FlexGet
- Hostens – 低價穩定的大盤雞
- TrustZone 使用者程式設計模型(GPIO Toggle例子)
- RGB LED Buck Converters 電路分析
- AWS 新區非洲(開普敦) 網路質量測試
- GitHub 教師工具箱
- I.MX RT 串列埠外設
- rclone 官方版無管理員OneDrive使用
- rclone 無管理員 Onedrive 使用