Google Drive account
DocsGoogle Drive account
AdvancedGoogle Drive account
Opera backs up (or syncs, without Sampler) to the app’s hidden folder on Google Drive (appDataFolder). By default the app uses the OAuth clients of the Maestro AI Google Cloud project. This guide shows how to replace them with your own, for example in a fork or a personal build.
What the app asks Google for
- API: Google Drive API.
- Scopes:
https://www.googleapis.com/auth/drive.appdata,email,profile.drive.appdataonly reaches the app’s hidden folder, never the rest of the Drive. - One OAuth client per platform:
| Platform | Google client type | Where it is used |
|---|---|---|
| Android | Android | ANDROID_CLIENT_ID in src/services/cloud/GoogleDriveProvider.ts |
| iOS | iOS | IOS_CLIENT_ID in the same file |
| Web and desktop | Web application | EXPO_PUBLIC_GOOGLE_WEB_CLIENT_ID, otherwise WEB_CLIENT_ID in the same file |
Android and iOS come back to the app through a URL scheme made of the reversed client ID (com.googleusercontent.apps.<id>:/oauth2redirect/google). That scheme must also be declared in app.json.
1. Create the project and enable the API
- Open the Google Cloud console and create a project.
- APIs & Services → Library: enable Google Drive API.
2. Set up the consent screen
- APIs & Services → OAuth consent screen (or Google Auth Platform → Branding).
- User type: External.
- Fill in the app name, the contact address, and the domain if you publish the web version.
- Data access (scopes): add
.../auth/drive.appdata,emailandprofile. - Audience:
- Testing: only accounts added as test users can sign in (100 at most). Google expires refresh tokens after 7 days in this mode, so users have to sign in again.
- In production: any Google account can sign in.
drive.appdatais not a sensitive scope, so Google’s verification stays light.
3. Create the OAuth clients
In APIs & Services → Credentials → Create credentials → OAuth client ID.
Android
- Type: Android.
- Package name:
ai.maestro.opera. Debug and preview builds (ai.maestro.opera.dev) work with this same client. - SHA-1 fingerprint of the key that signs your release APK: the SHA-1 of your upload key, or of the Google Play signing key if you use Play App Signing (Play Console → App integrity).
- In the client’s advanced settings, enable the custom URI scheme. The app comes back from the Google sign-in through that scheme; without it, Google refuses the redirect.
- Copy the client ID (
xxxx.apps.googleusercontent.com).
iOS
- Type: iOS.
- Bundle ID:
ai.maestro.opera. - Copy the client ID.
Web and desktop
- Type: Web application.
- Authorized JavaScript origins:
http://localhost:8081(npm run weblocally);- the origin of your published web version, for example
https://app.example.com.
- Authorized redirect URIs:
http://localhost:8081/oauth2redirect/google(local web);https://app.example.com/oauth2redirect/google(published web);http://localhost:46357/oauth2redirect/google(Opera Desktop opens the sign-in in the browser and listens on this fixed port).
- Copy the client ID.
Web and desktop get no refresh token: they ask to sign in again when the token expires, after about an hour.
4. Plug the clients into Opera
Android and iOS
-
In
src/services/cloud/GoogleDriveProvider.ts, replaceANDROID_CLIENT_IDandIOS_CLIENT_IDwith your client IDs. -
In
app.json, replace the twocom.googleusercontent.apps.390321100520-...entries of theschemelist with your reversed client IDs. For the client ID1234-abcd.apps.googleusercontent.com, the scheme iscom.googleusercontent.apps.1234-abcd. -
Regenerate the native project, then rebuild:
Terminal window npx expo prebuild --platform androidnpm run android
Web and desktop
Create a .env file at the root of the project, or secrets in your CI:
EXPO_PUBLIC_GOOGLE_WEB_CLIENT_ID=1234-abcd.apps.googleusercontent.comEXPO_PUBLIC_GOOGLE_REDIRECT_URI=https://app.example.com/oauth2redirect/googleEXPO_PUBLIC_GOOGLE_REDIRECT_URIonly matters for the published web version: it is used only when its origin is the page’s origin. Locally the app computeshttp://localhost:8081/oauth2redirect/googleon its own.- The
deploy-web.ymlworkflow already passesEXPO_PUBLIC_GOOGLE_REDIRECT_URIfrom the repository secrets. AddEXPO_PUBLIC_GOOGLE_WEB_CLIENT_IDthe same way if you publish the web version with your own client.
5. Check
- In the app, open Settings → Sync & backup and pick Google Drive.
- Sign in with an allowed account (a test user while the consent screen is in testing mode).
- The page shows your account. Run a sync or a backup, then check the Last synced or Last backup row.
Common errors
| Google error | Likely cause |
|---|---|
redirect_uri_mismatch |
The redirect URI is missing from the Web client’s list (port, /oauth2redirect/google path, or http vs https). |
invalid_request, scheme refused on Android |
The custom URI scheme is not enabled on the Android client, or the app.json scheme does not match the client ID. |
access_denied, “app not verified” |
The account is not a test user while the consent screen is in testing mode. |
| Signed out after a week | Consent screen in testing mode: refresh tokens expire after 7 days. Move it to production. |