I had a couple of posts in this blog to show you how to use Rclone to mount some different cloud drives, especally for Google Drives and OneDrives. Unfortunately the process for generating refresh_token using your own client_ID and client_secret is not documened clearly or already outdated in those posts. With recent changes from Google blocking Web GUI Rclone access request, I am writing this post to record those steps with screenshots with the referencef rom Rclone documentation.
- Using Rclone To Add Free Cloud Storage to VPS & Execute Read/Write Performance Test
- Use Rclone To Mount Azure Blob Storage into Local Windows File System
- Use Cloudflare Workers with Rclone to Deploy A Cloud Drive Index & List App – OnePoint
- Build Cloud Download Site Using One Docker (FileBrowser+Aria2+AriaNg+Rclone+Caddy)
- Mount Google Drive into NextCloud Using Rclone
- Use Aria2+AriaNg Docker to download and Use Rclone to Sync To Cloud Drives
Table of Contents
OneDrive to Create a New Client ID & Secret
Register an application with Azure AD and create a service principal
Let’s jump straight into creating the identity. If you run into a problem, check the required permissions to make sure your account can create the identity.
Sign in to your Azure Account through the Azure portal.
Select Azure Active Directory.
Select App registrations.
Select New registration.
Name the application, for example “example-app”. Select a supported account type, which determines who can use the application. Under Redirect URI, select Web for the type of application you want to create. Enter the URI where the access token is sent to. You can’t create credentials for a Native application. You can’t use that type for an automated application. After setting the values, select Register.
Create a client id and password:
Certificate and Password, click
New Client Password, enter a string of passwords, select the one with the longest time, and click
Add(Note: The password entered after adding will disappear, please record the value of client_secret)
API Permissions, click
MicroSoft Graph, enter file in the
Select Permissions, and check
Files.read (Note: Files.read is a read-only minimum permission. The permission in the figure is larger, and the same can be done ), click
Generate OneDrive/SharePoint Token
Using Rclone to Get Token
Get refresh token Using Online Tool
Fill in the client_id and client_secret obtained in the previous step into the https://tool.nn.ci/onedrive/request page, click Get Refresh Token, you can get the refresh token
Click purple button to fetch refresh token. It will ask you log into your Microsoft Onedrive account.
Google Cloud Platform to Create a New Client ID & Secret
From Local PC to Generate Google Drive Code and Refresh_Token
Configuring using rclone authorize
... Remote config Use web browser to automatically authenticate rclone with remote? * Say Y if the machine running rclone has a web browser you can use * Say N if running rclone on a (remote) machine without web browser access If not sure try Y. If Y failed, try N. y) Yes (default) n) No y/n> n For this to work, you will need rclone available on a machine that has a web browser available. For more help and alternate methods see: https://rclone.org/remote_setup/ Execute the following on the machine with the web browser (same rclone version recommended): rclone authorize "amazon cloud drive" Then paste the result below: result>
rclone authorize "amazon cloud drive" If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth Log in and authorize rclone for access Waiting for code... Got code Paste the following into your remote machine ---> SECRET_TOKEN <---End paste
result> SECRET_TOKEN -------------------- [acd12] client_id = client_secret = token = SECRET_TOKEN -------------------- y) Yes this is OK e) Edit this remote d) Delete this remote y/e/d>
Configuring by copying the config file
$ rclone config file Configuration file is stored at: /home/user/.rclone.conf
Alist Mount Storage
Fill in the values obtained in the above process one by one.
Get Sharepoint site_id
If you need to mount Sharepoint, after completing the previous step, an input site address will appear on the interface that displays the refresh token. After entering the site address, click Get site_id.
Root folder path
The default is
/, if you need to customize, just fill in the path, starting from the root path, the same as the local path, such as