Setting up Google OAuth 2.0 Credentials
Pro PlusEvents Manager I/O - GoogleRequires an Events Manager Pro Plus license. Compare plans
To import from or export to Google Calendar and Google Sheets, your site needs its own OAuth client in Google Cloud. You create it once, download a JSON file from Google, and upload that file to Events Manager I/O. After that, you and other administrators can connect Google accounts.
Google rearranges its Cloud console often, so this page describes what each step has to achieve and links to Google's own instructions, instead of naming every button. The values that come from your site are exact.
- Events Manager I/O and Events Manager I/O - Google are both active.
- You have a Google account that can create projects in the Google Cloud console.
- Your site uses HTTPS.
1. Create a project and enable the two APIs
-
In the Google Cloud console, create a project for your site, or select one you already use. Google's guide: Creating and managing projects.
-
In the project's API library, enable both the Google Calendar API and the Google Sheets API. Google's guide: Enable and disable APIs.
Enable both even if you plan to use only one. I/O requests access to calendars and to spreadsheets together when an account is connected.
2. Configure the consent screen
The consent screen is what people see when they connect a Google account to your site. In the project's OAuth consent settings:
-
Enter an app name and your contact email addresses.
-
Choose who may connect. If every account you will connect belongs to your own Google Workspace organization, choose the internal option. Otherwise choose external.
-
Add these scopes, which are the ones I/O requests:
Scope Gives access to https://www.googleapis.com/auth/calendarView and edit the account's calendars https://www.googleapis.com/auth/spreadsheetsView and edit the account's spreadsheets https://www.googleapis.com/auth/userinfo.emailThe account's email address https://www.googleapis.com/auth/userinfo.profileThe account's name and picture -
If the app is external and you leave it in testing, add every Google account you intend to connect as a test user.
I/O always asks for the full calendar and spreadsheet scopes, including when you only import. The read-only versions of those scopes are not enough.
The calendar and spreadsheet scopes are ones Google classes as sensitive. An external app that is not verified by Google shows a warning before the consent screen, and Google limits how long connections to an app in testing stay valid, which means reconnecting your accounts from time to time. For a site where only you and your colleagues connect accounts, that is usually acceptable. Google explains the options in OAuth app verification.
3. Create the OAuth client
-
In WordPress, go to Events I/O then Settings then Server-Side Credentials and open the Google box. Copy the URL shown after Your url for this site is. It looks like this:
https://yoursite.com/wp-admin/admin-ajax.php?action=emio_google&callback=authorizeThe orange flag in the box title turns into a green tick once a valid JSON file has been uploaded.
-
In the Google Cloud console, create credentials of the type OAuth client ID, with the application type Web application. Google's guide: Setting up OAuth 2.0.
-
Under Authorized redirect URIs, add the URL you copied, exactly as shown.
-
Save the client, then download its JSON file. Google offers the download when the client is created and again from the client's page.
4. Upload the JSON file to I/O
-
Back in the Google box at Events I/O then Settings then Server-Side Credentials, choose the JSON file you downloaded.
-
Click Save Changes.
The orange flag beside Google becomes a green tick, and the box says Looks like you have a valid App file already uploaded. To replace the credentials later, upload a new file in the same place.
Treat the JSON file like a password. It contains your client secret. Don't share it or commit it to a code repository.
5. Connect your accounts
Go to the Service Connections tab and click Connect in the Google panel. See Connect accounts. Once an account is connected, its calendars appear when you create a Google Calendar import or export, and you can point Google Sheets imports and exports at its spreadsheets.
Troubleshooting
"You need to upload a valid JSON file available from the developers console"
The file is not the JSON of a Web application client. I/O looks for a web section in the file, which other client types (desktop, service account) don't have. Create a Web application client and download its file.
Google shows "redirect_uri_mismatch"
The redirect URI saved in the OAuth client differs from the one your site sends. Copy it again from the Google box and replace the one in the client. It must match character for character.
Google shows "access blocked" or says the app has not completed verification
The account you are connecting is not allowed to use the app in its current state. Add the account as a test user on the consent screen, or publish the app.
"The Google App credentials are not properly configured."
No valid JSON file has been uploaded yet, so the Google formats and the Connect button are unavailable. Complete step 4.