Google Drive
Create your own OAuth client for Google Drive
CloudDrive2 adds Google Drive with an OAuth client that you create in your own Google Cloud project. It is free, takes about 5 minutes, and only needs to be done once. The steps below take place in the Google Cloud console.
Background
Why you need your own client
Google requires apps that can access all Google Drive files to pass Google's verification and a yearly security assessment. CloudDrive2's client has not been verified, so only the few Google accounts on its test user list can sign in with it; Google rejects everyone else.
A client you create yourself is used only by you and does not need verification. The sign-in and token exchange happen directly between Google and the CloudDrive2 running on your device, not through CloudDrive2's servers.
In the Google Cloud console
Create the client
Sign in to the Google Cloud console with the Google account you want to add to CloudDrive2, or with any other Google account.
-
Create a project
Open console.cloud.google.com/projectcreate. Enter any Project name, for example
clouddrive2, and leave Location as No organization. Click Create, then click Select project in the notification and check that the project is shown at the top of the page. -
Enable the Google Drive API
Open the Google Drive API page and click Enable. Without it, adding Google Drive fails with a message that the Google Drive API must be enabled.
-
Set up the OAuth consent screen
Open Google Auth Platform and click Get started. Then:
- App information: enter any App name and choose your email as User support email. Click Next.
- Audience: choose External. Click Next.
- Contact information: enter your email. Click Next.
- Finish: agree to the Google API Services: User Data Policy, click Continue, then Create.
-
Publish the app (required)
Click Audience in the left menu. Under Publishing status, click Publish app and confirm. The status changes to In production. Publishing does not require verification.
If the app stays in Testing, the refresh tokens Google issues expire after 7 days, and CloudDrive2 then loses access to that Google Drive.
-
Create a Desktop app client and download its file
Click Clients in the left menu, then Create client. Choose Desktop app as the Application type, enter any Name, and click Create.
In the dialog that appears, click Download JSON and keep the file
client_secret_….json. Google shows the client secret only once, when the client is created. If you closed the dialog without downloading it, add a new secret to the client.Do not choose Web application. That type cannot use the local callback address, and Google shows a
redirect_uri_mismatcherror during sign-in.
In CloudDrive2
Add Google Drive
-
Enter the client
In CloudDrive2, choose Add cloud → Google Drive. Choose the downloaded client file to fill in the client ID and client secret, or copy them in by hand.
-
Sign in with Google
Click Sign in with Google. The browser opens Google's sign-in page.
- When the page says Google hasn't verified this app: this is the app you created. Click Advanced, then Go to app name (unsafe).
- On the permissions page, tick the box for access to your Google Drive files and click Continue.
The browser then shows "Google Drive added", and the dialog in CloudDrive2 finishes by itself.
-
When the browser and CloudDrive2 are on different devices
For example, when you manage CloudDrive2 on a NAS or in Docker from a computer's browser: after you allow access, the browser opens a page that cannot be reached, with an address starting with
http://127.0.0.1. Copy the whole address from the address bar, paste it into "Address from the browser" in the CloudDrive2 dialog, and click Finish.
If you already have a refresh token for this client, tick "I already have a refresh token for this client" and enter the client ID, client secret and refresh token directly.
If your Google account is on CloudDrive2's test user list, you can instead choose "CloudDrive's Google client (test users only)" as the sign-in method, without creating a client.
Apple TV · Android TV
TV devices
TVs usually have no browser, so the Google sign-in cannot be done on them. Add Google Drive on a phone, a computer or in the web UI. With "sync data to cloud" turned on, the account syncs to TVs signed in to the same CloudDrive2 account. You can also enter the client ID, client secret and refresh token directly on the TV.
Common problems
Common problems
Google shows redirect_uri_mismatch
The client is not a Desktop app client. Create a Desktop app client as in step 5.
Google Drive stops working after 7 days
The app is still in Testing. Publish it as in step 4, then add Google Drive again.
A message says the Google Drive API must be enabled
Enable the Google Drive API in the same project as in step 2, then add Google Drive again.
A message says Google Drive access was not granted
On Google's permissions page, the box for access to your Google Drive files must be ticked.
Google is blocked on my network
CloudDrive2 needs to reach oauth2.googleapis.com and www.googleapis.com. Set an API proxy in the proxy settings when adding Google Drive. The browser also needs to be able to open Google's pages.
Does the 100-user limit for unverified apps affect me?
Only if you give the same client to other people. Personal use, including adding several of your own Google accounts, is not affected.
How do I revoke CloudDrive2's access?
Remove the app you created at myaccount.google.com/permissions.