OneDrive token expires in an hour and cannot sync?

2025/09/21 19:42:34 INFO  : Resync updating listings
2025/09/21 19:42:34 INFO  : Validating listings for Path1 "D:\CloudFiles\" vs Path2 "oneDrive:/"
2025/09/21 19:42:34 INFO  : Bisync successful
2025/09/21 19:42:34 INFO  : 
Transferred:   	   12.091 KiB / 12.091 KiB, 100%, 1.343 KiB/s, ETA 0s
Checks:               405 / 405, 100%, Listed 933
Deleted:                1 (files), 0 (dirs), 2.261 KiB (freed)
Renamed:                3
Transferred:            6 / 6, 100%
Server Side Moves:      3 @ 5.374 KiB
Elapsed time:        15.6s

2025/09/21 20:43:52 CRITICAL: Failed to create file system for destination "oneDrive:": failed to get root: Get "https://graph.microsoft.com/v1.0/drives/xxxxxxxxx/root": couldn't fetch token: invalid_grant: maybe token expired? - try refreshing with "rclone config reconnect oneDrive:"

Is there a setting or feature for automatically refreshing the token?

`rclone config reconnect oneDrive:` requires re-authorization.

Is it using a self-built application client_id, or can it only use rclone's client_id?

Microsoft OneDrive

rclone should do that automatically.


by default, rclone uses it own client_id.


when you posted, there was a template of questions. so far, none have been answered??

Should I use the Microsoft OneDrive document to create my own client_id for the application。

or to avoid expiration, should I only use rclone's public default client_id? I'll try again.

FYI - I use both options and both work. Hard to tell what is happening in your case as you do not share any details:)

https://entra.microsoft.com/ Application registration information:

`rclone authorize onedrive` command

After successfully updating the token using `rclone config reconnect oneDrive:`, it is only valid for 1 hour. After 1 hour, executing `rclone lsd oneDrive:` results in an error:

`2025/09/21 20:43:52 CRITICAL: Failed to create file system for destination "oneDrive:": failed to get root: Get "https://graph.microsoft.com/v1.0/drives/xxxxxxxxx/root": couldn't fetch token: invalid_grant: maybe token expired? - try refreshing with "rclone config reconnect oneDrive:"`

D:\>rclone config reconnect oneDrive:
Already have a token - refresh?
y) Yes (default)
n) No
y/n>

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

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" "eyJkxxxxxwifQ"
Then paste the result.
Enter a value.
config_token> {"access_token":"EwBYxxxxxDM$","expiry":"2025-09-22T23:07:50.3102186+08:00","expires_in":3599}

Option config_type.
Type of connection
Choose a number from below, or type in an existing value of type string.
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> 1

Option config_driveid.
Select drive you want to use
Choose a number from below, or type in your own value of type string.
Press Enter for the default (80xxxxx19).
 1 / OneDrive (personal)
   \ (80xxxxx19)
 2 / Bundles_b89xxxxxad7 (personal)
   \ (80xxxxx19)
 3 / AEEExxxxx500 (personal)
   \ (b!ZExxxxxeNX)
 4 / ODCMetadataArchive (personal)
   \ (b!ZExxxxx7oe)
config_driveid>

Drive OK?

Found drive "root" of type "personal"
URL: https://onedrive.live.com?cid=80xxxxx19&id=014xxxxxRRZ

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


D:\>

and post the output of
rclone version
rclone config redacted


why did you choose No instead of Yes ?

Tenant does not have a SPO license.

I give up, thank you everyone.

Storage> 38

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

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

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

Option tenant.
ID of the service principal's tenant. Also called its directory ID.
Set this if using
- Client Credential flow
Enter a value. Press Enter to leave empty.
tenant> 8b9xxxxx923

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

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>

2025/09/22 22:42:24 NOTICE: Make sure your Redirect URL is set to "http://localhost:53682/" in your custom config.
2025/09/22 22:42:24 NOTICE: If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=xWJ7l3ISa_KwQgJsuDJujw
2025/09/22 22:42:24 NOTICE: Log in and authorize rclone for access
2025/09/22 22:42:24 NOTICE: Waiting for code...
2025/09/22 22:42:27 NOTICE: Got code
Option config_type.
Type of connection
Choose a number from below, or type in an existing value of type string.
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> 1

Failed to query available drives: HTTP error 400 (400 Bad Request) returned body: "{\"error\":{\"code\":\"BadRequest\",\"message\":\"Tenant does not have a SPO license.\",\"innerError\":{\"date\":\"2025-09-22T14:42:52\",\"request-id\":\"93747cac-5766-42b6-982f-ad68e2b56670\",\"client-request-id\":\"93747cac-5766-42b6-982f-ad68e2b56670\"}}}"

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.