Skip to main content

One Drive

NOTE

Please read the Rclone Setup Guide first to configure your new backup storage:

Caution

Setting up Backup requires some basic know-how to use Terminal to perform the necessary configurations according to the instructions. If you do not understand what you are doing, please skip this backup storage!

1.1 Client ID

In this step, we don't want to set our own client id, so press enter to continue

Option client_id.
OAuth Client Id.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_id>

1.2 Client Secret

In this step, we don't want to set our own client secret, so press enter to continue

Option client_secret.
OAuth Client Secret.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_secret>

1.3 Region

In this step, I used Microsoft Cloud Global, so press enter to continue

Option region.
Choose national cloud region for OneDrive.
Choose a number from below, or type in your own string value.
Press Enter for the default (global).
1 / Microsoft Cloud Global
\ (global)
2 / Microsoft Cloud for US Government
\ (us)
3 / Microsoft Cloud Germany
\ (de)
4 / Azure and Office 365 operated by Vnet Group in China
\ (cn)
region>

1.4 Edit advanced config

In this step, we don't use Advanced Config to configure, so we type n and press enter to continue.

Edit advanced config?
y) Yes
n) No (default)
y/n> n

1.5 Auto Config

In this step, we are using a headless machine (your server), so we type n and press enter to continue.

Use auto config?
* Say Y if not sure
* Say N if you are working on a remote or headless machine

y) Yes (default)
n) No
y/n> n

2.1 Connect Rclone on your computer

You will see a highlight line in your process, just copy that line and continue to the next step.

Option config_token.
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 "onedrive"
Then paste the result.
Enter a value.
config_token>

2.2 Token

The authentication token will have the format:

{
"access_token": "xxxxx",
"token_type": "Bearer",
"refresh_token": "xxxxx",
"expiry": "xxxxx"
}

2.3 How to get tokens (Windows, Mac/Linux)

For Windows, download Rclone at:

https://downloads.rclone.org/rclone-current-windows-amd64.zip

Then proceed to extract it; you will see a list of files; pay attention to the line rclone.exe:

rclone-current-windows-amd64.zip
README.html
README.txt
git-log.txt
rclone.1
rclone.exe

Proceed to open your Terminal in the extracted folder (Command Prompt | Commander | Tabby | Hyper). I am using Tabby on Windows, then type the copied text in the above step:

rclone authorize "onedrive"

The Terminal will auto open this address using your browser.

2.4 Select the account to connect

Login to your Onedrive account:

Onedrive Login

2.5 Confirm connection permission

Click Yes to confirm permission for Rclone to access your account's OneDrive.

Onedrive Permissions

After completing the authorization process, your browser will automatically redirect you to an address that looks like: https://localhost:53682/?code=xxxxx&state=xxxxx with the message: Success! All done. Please go back to rclone.

Onedrive Permissions Success

And on your Terminal window, it will show something like:

2021/10/08 17:50:58 NOTICE: Got code
Paste the following into your remote machine --->
{"access_token":"EwB4A8l6BAAUkj1NuJYtTV","expiry":"2022-12-09T11:39:22.003526+07:00"}
<---End paste

You notice the 3rd line.

Our task is copy the content located between the lines Paste the following into your remote machine ---> and <---End paste to fill in the config token in the Step 2.1 then continue to the next step

2.6 Shared Drive

I'm using Onedrive default. So press enter to continue.

Option config_type.
Type of connection
Choose a number from below, or type in an existing string value.
Press Enter for the default (onedrive).
1 / OneDrive Personal or Business
\ (onedrive)
2 / Root Sharepoint site
\ (sharepoint)
/ Sharepoint site name or URL
3 | E.g. mysite or https://contoso.sharepoint.com/sites/mysite
\ (url)
4 / Search for a Sharepoint site
\ (search)
5 / Type in driveID (advanced)
\ (driveid)
6 / Type in SiteID (advanced)
\ (siteid)
/ Sharepoint server-relative path (advanced)
7 | E.g. /teams/hr
\ (path)
config_type>

2.7 Drive ID

I'm using Onedrive ID default. So press enter to continue.

Option config_driveid.
Select drive you want to use
Choose a number from below, or type in your own string value.
Press Enter for the default (3a6bd9e7ad8a0d75).
1 / (personal)
\ (xxxxx)
config_driveid>

2.8 Drive Root

I'm using Onedrive Root default. So press y to continue.

Drive OK?

Found drive "root" of type "personal"
URL: https://onedrive.live.com/?cid=xxxxxx
y) Yes (default)
n) No
y/n>

2.9 Confirmation

This step will display the information you have chosen to set up in the steps above.

After confirming the information is correct, press y and enter to ensure the completion of the connection process.

Configuration complete.
Options:
- type: onedrive
- token: {"access_token":"EwB4SewHwkaZZqtfFM5DPen2X3kC","token_type":"Bearer","refresh_token":"M.R3_VAxp8zX9Aqivo$","expiry":"2022-12-09T11:39:22.003526+07:00"}
- drive_id: xxxxxxxx
- drive_type: personal
Keep this "onedrive" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y

2.10 Finish

The last step will show the connections you have successfully added.

So we have completed the steps to connect to OneDrive to Rclone

Type q and press enter to end the process.

Current remotes:

Name Type
==== ====
mybackup onedrive

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q

2.11 Authenticate with XVPS

At the end of our task, fill exactly in the following instructions item:

  1. Input the title for your new backup task (anything that you like).
  2. Select Microsoft OneDrive in the storage provider.
  3. Input exactly mybackup as I set in Step 1.4: Rclone Setup Guide into the Storage Name field.
Add Storage
Caution

Carefully check the information after filling it in again. XVPS will check these information and throw an error if your information is incorrect

After that, click Add Storage and wait for confirmation from the system.

If you receive a successful message from the system; congratulations, your association with new storage has been successful.