| Type | Download |
|---|---|
| Plugin file | Download |
| Checksum | SHA256 |
This plugin automatically uploads a completed download file to a configured Google Drive folder.
The plugin runs on the download.completed trigger and requires the following configuration values:
| Config key | Required | Description |
|---|---|---|
client_id |
Yes | OAuth 2.0 Client ID from Google Cloud Console |
client_secret |
Yes | OAuth 2.0 Client Secret paired with the Client ID |
refresh_token |
Yes | Token used by the plugin to request fresh access tokens |
folder_id |
Yes | Destination Google Drive folder ID |
filename_format |
No | Template for the uploaded file name |
- Open Google Cloud Console.
- Create a new project or select an existing project.
- Go to APIs & Services -> Library.
- Search for Google Drive API.
- Click Enable.
- Go to APIs & Services -> OAuth consent screen.
- Choose the app type:
- External for a personal Gmail account.
- Internal for an internal Google Workspace app.
- Fill in the required fields, such as app name, user support email, and developer contact email.
- Add this scope:
https://www.googleapis.com/auth/drive.file
The drive.file scope allows the plugin to create and manage files uploaded by the plugin. If you need to upload to a Shared Drive or run into folder permission issues, you can use the broader scope:
https://www.googleapis.com/auth/drive
Only use drive when needed because it grants broader Drive access.
- If the app is in Testing, add your Google account under Test users.
- For a long-lived
refresh_token, publish the app as In production after setup. Apps left in testing can produce refresh tokens that expire sooner.
- Go to APIs & Services -> Credentials.
- Click Create credentials -> OAuth client ID.
- Set Application type to Desktop app.
- Use a recognizable name, such as
Youwee Google Drive Upload. - Click Create.
- Copy these values:
- Client ID -> plugin field
client_id - Client secret -> plugin field
client_secret
- Client ID -> plugin field
Example format:
client_id: 1234567890-abc123.apps.googleusercontent.com
client_secret: GOCSPX-xxxxxxxxxxxxxxxx
The easiest way to get a refresh token is with Google OAuth 2.0 Playground.
- Open OAuth 2.0 Playground.
- Click the settings icon in the top-right corner.
- Enable Use your own OAuth credentials.
- Enter:
- OAuth Client ID: the
client_idyou created. - OAuth Client secret: the
client_secretyou created.
- OAuth Client ID: the
- In the left panel, enter this scope:
https://www.googleapis.com/auth/drive.file
If you configured the broader drive scope on the OAuth consent screen, enter:
https://www.googleapis.com/auth/drive
- Click Authorize APIs.
- Sign in with the Google account that should upload files to the destination Drive folder.
- Accept the permission screen.
- After OAuth Playground redirects back, click Exchange authorization code for tokens.
- Copy Refresh token -> plugin field
refresh_token.
Example format:
refresh_token: 1//0gabc123...
Notes:
refresh_tokenis sensitive. Do not commit it to git or share it publicly.- If you change the OAuth client, change scopes, revoke app access, or the token expires, generate a new
refresh_token. - If you get
invalid_grant, generate a newrefresh_tokenand check whether the OAuth consent app has been published In production.
- Open Google Drive.
- Open the folder where the plugin should upload files.
- Check the browser URL. It usually looks like this:
https://drive.google.com/drive/folders/1AbCdEfGhIjKlMnOpQrStUvWxYz
- Copy the value after
/folders/:
1AbCdEfGhIjKlMnOpQrStUvWxYz
- Enter that value in plugin field
folder_id.
The Google account used to create the refresh_token must have permission to create files in this folder.
filename_format is optional. If left empty, the plugin uses the original file name:
{filename}
Supported placeholders:
| Placeholder | Value |
|---|---|
{filename} |
Original file name, including extension |
{basename} |
Original file name without extension |
{ext} |
File extension |
{title} |
Media title, if available in the payload |
{source} |
Download source, such as youtube |
{quality} |
Download quality, such as 1080p |
{format} |
Download format, such as mp4 |
{date} |
Upload date in YYYY-MM-DD format |
{timestamp} |
Unix timestamp in milliseconds |
Example:
{title} [{quality}]
If the original file is video.mp4, the title is Sample video, and the quality is 1080p, the plugin uploads the file as:
Sample video [1080p].mp4
The plugin automatically removes invalid filename characters such as /, \, :, *, ?, ", <, >, and |.
In the plugin configuration screen, enter:
client_id = OAuth Client ID
client_secret = OAuth Client Secret
refresh_token = Refresh token from OAuth Playground
folder_id = Destination Google Drive folder ID
filename_format = {filename}
After saving the configuration, every completed download will make the plugin:
- Use
refresh_tokento request a Google access token. - Read the completed file from the
download.completedpayload. - Upload the file to the Drive folder configured by
folder_id. - Return metadata including Google Drive file ID, uploaded file name, view link, and uploaded size.
The refresh token is no longer valid.
Fix:
- Generate a new
refresh_tokenwith OAuth Playground. - Make sure you are signed in with the correct Google account.
- If the OAuth consent screen is still in Testing, publish it as In production for a more stable token.
The Google account does not have permission to upload into the destination folder, or the OAuth scope is too narrow.
Fix:
- Check that the account used to create
refresh_tokenhas Editor access to the destination Drive folder. - Verify
folder_id. - If you use a Shared Drive or a special folder, try generating the token with
https://www.googleapis.com/auth/drive.
The destination Drive folder does not exist or the Google account cannot access it.
Fix:
- Open the Drive folder URL with the same account used to create
refresh_token. - Copy
folder_idagain from the URL. - Make sure the folder has not been deleted or moved to an inaccessible location.
The plugin has timeoutSec set to 300, which means each run can take up to 5 minutes.
Fix:
- Check the network connection.
- Test with a smaller file to confirm the configuration works.
- If large uploads are common, increase the plugin manifest timeout if the runtime should allow longer uploads.
- Do not share
client_secretorrefresh_token. - Use a dedicated Google Cloud project for this plugin when possible.
- Use the narrowest scope that works, preferably
drive.file. - If you suspect a token was exposed, revoke the app access from Google Account -> Security -> Third-party access, then generate a new token.