google-drive.md 1.9 KB


type: docs order: 32 title: "Google Drive" module: "@uppy/google-drive"

permalink: docs/google-drive/

The @uppy/google-drive plugin lets users import files from their Google Drive account.

An Uppy Server instance is required for the @uppy/google-drive plugin to work. Uppy Server handles authentication with Google, downloads files from the Drive and uploads them to the destination. This saves the user bandwidth, especially helpful if they are on a mobile connection.

const GoogleDrive = require('@uppy/google-drive')

uppy.use(GoogleDrive, {
  // Options
})

Try live!

Installation

This plugin is published as the @uppy/google-drive package.

npm install @uppy/google-drive

In the CDN package, it is available on the Uppy global object:

const GoogleDrive = Uppy.GoogleDrive

Options

uppy.use(GoogleDrive, {
  target: Dashboard,
  serverUrl: 'https://server.uppy.io/',
})

id: 'GoogleDrive'

A unique identifier for this plugin. Defaults to 'GoogleDrive'.

target: null

DOM element, CSS selector, or plugin to mount the Google Drive provider into. This should normally be the the @uppy/dashboard plugin.

serverUrl: null

URL to an Uppy Server instance.

serverHeaders: {}

Custom headers that should be sent along to Uppy Server on every request.

serverPattern: serverUrl

The valid and authorised URL(s) from which OAuth responses should be accepted.

This value can be a String, a Regex pattern, or an Array of both.

This is useful when you have your Uppy Server running on multiple hosts. Otherwise the default value should be good enough.

locale: {}

Localize text that is shown to the user.

The default English strings are:

strings: {
  // TODO
}