Setting Up Google Integration
Wagtail Google Docs integration relies on Google APIs, which you will first need to enable for your project:
-
Navigate to the Google API Library. Select a project for your Wagtail site, or create a new one now.
-
Find and enable the Google Docs and Google Drive APIs.
-
Find and enable the Google Picker API, and copy its API key to the setting
WAGTAILCONTENTIMPORT_GOOGLE_PICKER_API_KEY
. -
Open the Credentials page in the API Console.
-
Select
Create credentials
, thenOAuth client ID
-
If you haven't already configured the consent screen, you will need to configure this now.
-
Under
Scopes for Google APIs
, clickAdd scope
. -
Add
../auth/documents.readonly
and../auth/drive.readonly
scopes.Note: adding these sensitive scopes means that you will need to submit your project for verification by Google to avoid user caps and warning pages during use.
-
Add your domain to
Authorised domains
.
-
-
For
Application type
, chooseWeb application
-
Under
Authorised JavaScript origins
, add your domain. -
On the Credentials page, next to your Client ID, click the download item to download a JSON file of your client secret.
-
Copy the text from this file, and use it to set
WAGTAILCONTENTIMPORT_GOOGLE_OAUTH_CLIENT_CONFIG
.
Note
For users to authenticate with Google and import documents from their Drives, they must either allow third party cookies or add accounts.google.com
to their allowed domains (Settings/Privacy and Security/Cookies and other site data in Chrome or Preferences/Privacy & Security in Firefox).