Zerowallet
Search
⌃K
Comment on page

Setting up Google Drive Recovery

Here we demonstrate the steps for achieving Google Drive Recovery
If you are not familiar with this type of recovery or Zerowallet recovery at all, please learn moreRecovery.

Create a Google Cloud Project

Go to https://console.cloud.google.com/ and log into your Google account. Now create a new project on the cloud. Add the project name and the name of your organization. Then select the newly created project.

Enable Google Drive API

This step allows the cloud project to utilize the Google Drive API so it can add new files and folders to the user's Drive. Navigate to the Dashboard after selecting the newly created project. Search for the Google Drive API and enable it.
The Zerowallet relies on Google OAuth 2.0 for authorization. This step is for showing users consent screens when they are setting up or initiating Google Recovery.
  • Search and Go to OAuth Consent Screen. Choose the user type (internal or external) according to your needs. Add the details such as the app name, support email, domain, etc.
  • Click 'save and continue' and go to the next page. Now you need to pick the scopes of the project. Click 'Add or remove scopes' then search for Google Drive API in the scopes. Select the scope: ./auth/drive.file with the description: See, edit, create, and delete only the specific Google Drive files you use with this app.
  • Click 'save and continue' and go to the next page. Next you need to add the test users for your application.
  • Click 'save and continue' and go to the next page. Review the summary of the application in the last page.

Client ID Credentials

Go to Credential from the left sidebar. Click "Create credentials", then choose OAuth Client ID from the drop-down. Choose the application type according to your needs whether it be web or Android app, etc. Add the Authorized JavaScript origins and Authorized redirect URIs (in case of web app). If you're testing a Next JS project, for example, http://localhost:3000 is the default URI.
After saving, copy your Client ID and use it when using the package. To set the options of the Google recovery below is an example retrieved from https://github.com/questbook/zero-wallet-wagmi-connector/tree/main/example​
const googleRecoveryOption: RecoveryConfig = {
type: 'google-web-recovery',
googleClientId: process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID!,
allowMultiKeys: false,
handleExistingKey: 'Overwrite'
};