Google Drive Client ID and Client Secret
Author: Swapna Naraharisetty, 2BrightSparks Pte. Ltd.
When an application is registered with Google Drive, a unique Client ID and Client Secret are generated for the app. These credentials are used in the app’s code to authenticate directly to Google services and send requests to Google Drive’s API.
When you use SyncBackPro to backup files to Google Drive, SyncBackPro’s registered client ID is used for authentication and to request access to data using Google Drive’s API. All SyncBackPro customers backing up files to Google Drive will share the same client ID. To ensure that Google Drive’s API is fairly used by all users and to prevent excessive usage of the service, Google sets quotas and limits on API requests. The quotas apply to the number of requests sent to the service from the application and individual users. Basically, this means there is a limit to how much SyncBackPro can communicate with Google Drive and that limit is shared by all users.
If the application exceeds the overall quota that Google has set for SyncBackPro when performing file backups to Google Drive, then you may receive a "403: User rate limit exceeded" error containing the project number 1092308504260. If you receive this error, we suggest creating your own client ID and client secret for SyncBackPro through the Google Cloud Console.
In this article, we will go through the steps for creating a Google Drive client ID and client secret for SyncBackPro (minimum V10, it is not supported in V9 and older versions).
Creating a custom Google Drive Client ID and Client Secret
A YouTube video is available that shows, step-by-step, how to create a Client ID and Client Secret for Google Drive. Alternatively, follow the instructions below.
- Login to the Google API Console
- Click “Select a Project” dropdown (on the top left) > select a project or create a “New Project”.
- Enable Google Drive API in the Google Cloud Project. Click on “Enabled APIs and Services”, search for “Drive” and enable the “Google Drive API”.
- All apps using OAuth 2.0 require a consent screen configuration. To configure the consent screen, click “Credentials” (on the left panel) and click on the “CONFIGURE CONSENT SCREEN” button (near the top right corner of the right panel).
- Then select “External” and click on the “CREATE” button.
- Enter an “Application name”, “User Support Email” and “Developer Contact Email” and click on the “Save” button (all other fields are optional).
- On the next screen, you need to define scopes (level of access) for your app. The scopes needed by SyncBackPro are:
…/auth/drive (See, edit, create, and delete all of your Google Drive files)
…/auth/userinfo.email (See primary Google Account email address)
…/auth/userinfo.profile (See your personal info you have made publicly available)
- After adding scopes, click “Save and continue” to add test users. You should add your own Google account to the list of test users and save the changes.
- Next, you need to create credentials. Credentials are used to obtain an access token from Google's authorization servers so that the app can call Google APIs.
Click again on “Credentials” on the left panel to go back to the “Credentials” screen. Click on the “+CREATE CREDENTIALS” button at the top of the window, and then select “OAuth client ID”.
- Change the Application type to “Desktop app” and give it a name. Then click on the “Create” button.
- On the next screen, you will be presented with your client ID and client secret. Keep a copy of these credentials.
- Once you have created your credentials, go back to the “OAuth consent screen”, click “PUBLISH APP” button, and confirm. Then add your Google account as a test user. Important: Do not click the "Prepare for Verification" button. Verification is not required.
- Enter the Client ID and Client Secret provided in step 11 into SyncBackPro (see below).
- IMPORTANT: You must now re-authorize with Google Drive. See below.
Using the Google Drive Client ID and Client Secret
If you are using SyncBackPro V11.2.47.0 or newer, then you simply need to go to the Cloud Accounts settings and (re)-authorize with Google Drive, this time supplying the Client ID and Client Secret you created. A YouTube video is available that shows how to do this.
However, if you are using SyncBackPro V10, or a version older than V11.2.47.0, follow these steps:
- SyncBackPro V11: Click Preferences -> "Output debug information" from the main menu (the menu item should now be ticked).
- SyncBackPro V10: Click on the burger menu > Preferences page, and tick on the “Output debug information” checkbox.
- Go to burger menu > Global Settings > Patches settings page. Enter the client ID and client secret and click OK.
- Untick “Output debug information” from the Preferences menu/page.
- Re-authorize with Google Drive from Linked Cloud account page, Cloud page or Shared settings.
- Run the Google Drive profile.
If you upgrade to SyncBackPro V11.2.47.0 in future, you will not need to do anything as the client ID and secret you entered will be used.
Conclusion
In this article, you've learned how to create your own Google Drive API Client ID and Client Secret from the Google API console and use them with SyncBackPro.