Self-hosted server

Google Drive file picker

Let users pick files from their Google Drive when opening files in Stirling PDF. It works on every plan.

1. Set up Google Cloud#

  1. Create or choose a Google Cloud project, following Setting up your environment in Google's Picker API guide.
  2. In Credentials, select Create credentials → OAuth client ID. Add your Stirling PDF address (for example https://pdf.example.com) to the client's Authorized JavaScript origins.
  3. In the same place, select Create credentials → API key.
  4. Note your project number from IAM & Admin settings. This is the app ID.

2. Configure Stirling PDF#

Enter the values in Settings → Server → Integrations → Google Drive, or in settings.yml:

yaml
premium:
  proFeatures:
    googleDrive:
      enabled: true
      clientId: <client-id>   # the OAuth client ID
      apiKey: <api-key>       # the API key
      appId: <app-id>         # the project number
bash
PREMIUM_PROFEATURES_GOOGLEDRIVE_ENABLED=true
PREMIUM_PROFEATURES_GOOGLEDRIVE_CLIENTID=<client-id>
PREMIUM_PROFEATURES_GOOGLEDRIVE_APIKEY=<api-key>
PREMIUM_PROFEATURES_GOOGLEDRIVE_APPID=<app-id>

Connected accounts#

To let users connect their Google account for Processor sources, also set these. Add https://<server>/api/v1/connected-accounts/callback/google as an authorised redirect URI, and publish the OAuth app: tokens from an app in testing expire after 7 days. Needs login turned on.

Setting Default Purpose
clientSecret empty The OAuth client secret.
allowAccountConnections true false stops users connecting their own account.
accountScope drive drive (every file), drive.file (only files users pick or Stirling creates) or drive.readonly.