Google Drive

Content & assets

Google Drive

Let end-users pull assets from their own Google Drive. MailKaro uses the Google Picker with the non-restricted drive.file scope, so there's no Google verification or CASA audit, the app only ever sees the files the user picks.

Zero-config#

The simplest setup uses MailKaro's hosted connect page and default client id, the integrator does no Google setup:

tsx
<EmailEditor googleDrive={true} />
// or, lower level:
<EmailEditor config={{ assets: { googleDrive: true } }} />

In the drop-in editor, googleDrive={true} opens a popup on ${apiBaseUrl}/drive/connect, Google auth + the Picker run there, on MailKaro's origin, so your domain never needs to be whitelisted in Google. Picked files are auto-shared “anyone with link” and returned as stable CDN URLs. The OAuth token stays on MailKaro's origin; only the finished public URLs come back.

“Pick more” doesn't re-prompt. The connect page caches the grant (~1 hour), so the second pick jumps straight to the Picker.

Configuration#

ts
googleDrive?:
  | boolean
  | {
      clientId?: string;      // your own OAuth Web client (inline mode)
      developerKey?: string;  // browser API key for the Picker (non-secret)
      appId?: string;         // Google Cloud project NUMBER
      connectUrl?: string;    // hosted connect page (Approach B popup)
      scope?: string;         // default: drive.file
    }

Bring your own Google project (inline)#

tsx
<EmailEditor config={{ assets: {
  googleDrive: {
    clientId: "1234-abc.apps.googleusercontent.com", developerKey: "AIza…", appId: "490986048072"
  }
}}} />

Inline mode runs the Picker directly on your page, so your origin must be listed in the OAuth client's Authorized JavaScript origins, and the Google Picker API must be enabled.

Hosted connect popup (your own domain)#

tsx
<EmailEditor config={{ assets: {
  googleDrive: { connectUrl: "https://api.mailkaro.com/drive/connect" }
}}} />
Rendering in a sent email: a Drive file only renders for recipients if it's shared publicly. MailKaro auto-shares picked files “anyone with link”; note that Google Workspace domains that block public link-sharing will prevent this.