The hTech OS Backup Module supports two ways to authenticate with Google Drive using OAuth 2.0.
This article explains both methods, when to use each one, and how to configure them step by step.
Google Drive Authentication Options
You may choose either authentication method:
- Access Token Only (Temporary)
- Client ID + Client Secret + Refresh Token (Recommended)
Option 1: Access Token Only (Temporary Access)
When to Use This Option
This option is intended for:
- Short-term testing
- One-time manual backups
- Temporary access scenarios
Important: Access tokens expire automatically (usually within 1 hour). When the token expires, uploads will stop until a new token is provided.
Step 1: Open Google OAuth 2.0 Playground
Open the Google OAuth 2.0 Playground in your browser.
Step 2: Select Google Drive Scope
- In the left panel, find Drive API v3.
- Select the scope:
https://www.googleapis.com/auth/drive.file
- Click Authorize APIs.
Step 3: Approve Access
- Log in to the Google account where backups will be stored.
- Click Allow.
Step 4: Get the Access Token
- Back in OAuth Playground, click Exchange authorization code for tokens.
- Copy the value labeled access_token.
Step 5: Enter Access Token in WHMCS
- Go to WHMCS Admin → Addons → hTech OS Backup → Settings.
- Select Google Drive as the storage provider.
- Paste the access token into the Access Token field.
- Save settings.
Reminder: When the access token expires, backups will fail until a new token is generated.
Option 2: Client ID + Client Secret + Refresh Token (Recommended)
When to Use This Option
This is the recommended and permanent configuration.
Use this option if:
- You want automatic scheduled backups
- You do not want to re-authenticate
- You want long-term stability
The refresh token does not expire unless access is revoked.
Step 1: Create a Google Cloud Project
- Open Google Cloud Console.
- Create a new project (example: HTech WHMCS Backups).
- Select the new project.
Step 2: Enable Google Drive API
- Go to APIs & Services → Library.
- Search for Google Drive API.
- Click Enable.
Step 3: Configure OAuth Consent Screen
- Go to APIs & Services → OAuth consent screen.
- Select External.
- Set:
- App name: hTech OS Backup
- User support email
- Developer contact email
- Add your Google account as a Test User.
- Save and finish.
Step 4: Create OAuth Client Credentials
- Go to APIs & Services → Credentials.
- Create OAuth client ID.
- Application type: Web application.
- Add these Authorized redirect URIs:
http://localhosthttps://developers.google.com/oauthplayground
- Create the credentials.
Save the Client ID and Client Secret.
Step 5: Generate Refresh Token Using OAuth Playground
- Open Google OAuth 2.0 Playground.
- Click the Settings icon.
- Enable Use your own OAuth credentials.
- Paste your Client ID and Client Secret.
- Enable Request refresh token.
- Ensure Access type is Offline.
Step 6: Authorize Google Drive
- Select the scope:
https://www.googleapis.com/auth/drive.file
- Click Authorize APIs.
- Log in and approve access.
Step 7: Get the Refresh Token
- Click Exchange authorization code for tokens.
- Copy the value labeled refresh_token.
This refresh token provides permanent access.
Step 8: Enter Credentials in WHMCS
- Go to WHMCS Admin → Addons → hTech OS Backup → Settings.
- Select Google Drive.
- Enter:
- Client ID
- Client Secret
- Refresh Token
- Save settings.
- Click Verify Remote.
Which Option Should I Use?
- Temporary testing: Access Token Only
- Production backups: Client ID + Secret + Refresh Token
Troubleshooting
- Access token expired: Generate a new one or switch to refresh token method.
- No refresh token returned: Ensure “Request refresh token” is enabled.
- Redirect error: Confirm OAuth Playground URL is added to redirect URIs.
If issues persist, run the module System Health Check or contact support.