Token Management and Maintenance
Last updated on 2026-08-24 | Edit this page
Estimated time: 20 minutes
Overview
Questions
- How do I know when my rclone token has expired?
- What is token expiration and why does it happen?
- How do I refresh an expired token?
Objectives
- Understand OAuth token lifecycle and expiration
- Check token validity with rclone about
- Refresh expired tokens using
rclone config reconnect - Set up reminders for proactive token renewal
Understanding OAuth Token Expiration
How OAuth Works
When you ran rclone config and authenticated via Box or
OneDrive, you received an OAuth token. This token is
like a temporary access card: 1. You authenticated once (via the browser
OAuth flow) 2. rclone received a token that proves your identity 3. The
token is stored in ~/.config/rclone/rclone.conf 4. rclone
uses this token to access Box/OneDrive without your password
Why Tokens Expire
OAuth tokens don’t last forever. They typically expire every 2-3 months for security reasons: - Limits damage: If someone steals a token, they can’t use it forever - Enforces re-authentication: You must periodically prove your identity again - Improves security: Forces you to use current authentication methods (2FA, password updates, etc.)
Checking Your Token Status
The simplest way to check if your token is still valid:
If you see storage information, your token is valid. If you see an error, it needs renewal.
Test all your configured remotes:
Renewing Expired Tokens
Important: Port Forwarding for Token Renewal
Just like initial setup, token renewal needs port forwarding:
Then in the SSH session, run reconnect commands.
Setting Up Token Renewal Reminders
Create a cron job that reminds you to refresh tokens:
BASH
# Add to crontab
0 2 1 */2 * echo "Time to refresh rclone tokens!" | mail -s "Reminder" $USER@pomona.edu
This sends a reminder email on the first day of every other month.
For valid tokens, you should see storage info for each:
Checking Box token...
Total: 1.0T
Used: 45.2G
Free: 954.8G
Checking OneDrive token...
Total: 1.0T
Used: 8.4G
Free: 991.6G
If a token has expired, you will see:
ERROR : error: invalid_grant: The provided authorization grant is invalid.
An expired token is not a problem – renew it with
rclone config reconnect.
Challenge 11.2: Practice Token Renewal
During the reconnect, you should see:
NOTICE: AUTHORIZATION REQUIRED
Go to the following link in your browser: http://localhost:53682/auth?code=...
After completing OAuth:
NOTICE: Authorization successful!
Seeing storage info from rclone about confirms the token
was refreshed. Remember: you must have SSH port forwarding active for
reconnect to work.
- OAuth tokens expire every 2-3 months and should be refreshed proactively with rclone config reconnect
- Use rclone about remote: to test token validity before running important automated jobs
- Token renewal requires SSH port forwarding (-L 53682:localhost:53682) just like initial setup
- Set calendar or cron reminders to refresh tokens before they expire