> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://support.webnus.net/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Creating Google Calendar API Key

This guide explains how to create a **Google Calendar API Key** using the **current Google Cloud Console interface** and connect it to **Modern Events Calendar (MEC)**.  
No prior experience with Google APIs is required.

## **Step 1: Sign in to Google Cloud Console**

1.  Open the Google Cloud Console:  
    [https://console.cloud.google.com/](https://console.cloud.google.com/)
2.  Sign in using your Google account.

If this is your first time using Google Cloud, Google may ask you to accept terms of service or select a country. Complete those steps before continuing.

## **Step 2: Create or Select a Project**

All Google APIs must belong to a **project**.

1.  At the top of the console, click **Select a project**.
2.  If you already have a project, select it.
3.  If not, click **New Project**.

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/image-24-1024x551.png "image 24 - Creating Google Calendar API Key")

4.  Enter a **Project name** (any name is fine).
5.  Click **Create**.
6.  Make sure the newly created project is selected.

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/image-25-1024x603.png "image 25 - Creating Google Calendar API Key")

Every API key, permission, and setting you create will belong to this project.

## **Step 3: Enable Google Calendar API**

The API must be explicitly enabled before it can be used.

1.  Open the main menu (☰).
2.  Go to **APIs & Services → Library**.

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/image-26.png "image 26 - Creating Google Calendar API Key")

3.  In the search box, type **Google Calendar API**.

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/image-43-1024x456.png "image 43 - Creating Google Calendar API Key")

4.  Click on **Google Calendar API**.

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/image-42-1024x359.png "image 42 - Creating Google Calendar API Key")

5.  Click **Enable**.

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/image-28.png "image 28 - Creating Google Calendar API Key")

Without this step, the API key will not work even if it is created successfully.

## **Step 4: Create and Configure API Key**

In this step, you will create the API key that MEC uses to communicate with Google Calendar.

Google now combines creating the API key and applying restrictions into a **single step**:

1.  Go to **APIs & Services → Credentials**.

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/image-37.png "image 37 - Creating Google Calendar API Key")

2.  Click **Create credentials → API key**.

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/image-45-1024x430.png "image 45 - Creating Google Calendar API Key")

3.  A popup appears:
    *   **Name your API key** (any descriptive name, e.g., “MEC Calendar Key”)
    *   Optionally, under **Restrict your key to reduce security risks**:
        *   Set **API restrictions** → select **Google Calendar API**
        *   Set **Application restrictions** → for example, **HTTP referrers** (add your website domain)
4.  Click **Create**.

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/image-47-1024x550.png "image 47 - Creating Google Calendar API Key")

5.  Your new API key will now be displayed. Copy and save it safely.

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/image-36.png "image 36 - Creating Google Calendar API Key")

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/image-39-1024x462.png "image 39 - Creating Google Calendar API Key")

This flow merges key creation and restriction setup. You no longer need separate steps for restricting the key.

## **Step 5: OAuth Setup – For Private Calendars Only**

⚠️ Skip this step if you only need access to public calendars.

Most users who only want to import public calendars do not need to complete this step.

If you need to access **private calendars**, Google requires user authorization via OAuth.

### **Configure OAuth Consent Screen**

1.  Go to **APIs & Services → OAuth consent screen**.

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/11.png "11 - Creating Google Calendar API Key")

2.  Click the **Get started** button.
3.  Complete the **App Information** section:
    *   **App name**
    *   **User support email**

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/image-30.png "image 30 - Creating Google Calendar API Key")

4.  Click **Next**, then in the **Audience** section, select **External**.

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/image-34.png "image 34 - Creating Google Calendar API Key")

5.  Click **Next**, then in **Contact Information**, enter your email address(es).

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/image-29.png "image 29 - Creating Google Calendar API Key")

6.  Click **Next**, then check the box:
    *   **I agree to the Google API Services: User Data Policy**
7.  Click **Continue**, then click **Create**.

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/image-27.png "image 27 - Creating Google Calendar API Key")

### **Create OAuth Client ID**

After completing the OAuth Consent Screen setup:

1.  On the next page after finishing the OAuth consent setup, you can click the **Create OAuth client** button.

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/image-32-1024x315.png "image 32 - Creating Google Calendar API Key")

2.  Alternatively, you can go to **APIs & Services → Credentials** and click **Create credentials → OAuth client ID**.

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/image-46-1024x404.png "image 46 - Creating Google Calendar API Key")

Then:

3.  Select **Web application**.

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/image-33.png "image 33 - Creating Google Calendar API Key")

4.  Enter a name for your client (any descriptive name).
5.  Add **Authorized redirect URIs** if required by your integration.
6.  Click **Create**.

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/image-40-1024x719.png "image 40 - Creating Google Calendar API Key")

Both methods (via the **Create OAuth client button** or the **Credentials menu**) achieve the same result. Use whichever is more convenient.

OAuth credentials are separate from the API key and are only needed when accessing private calendar data.

## **Step 6: Get Your Google Calendar ID**

1.  Open [**Google Calendar**](https://calendar.google.com/).
2.  Click **Settings**.
3.  Under **Settings for my calendars**, select the calendar you want to use.

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/image-31.png "image 31 - Creating Google Calendar API Key")

4.  Find and copy the **Calendar ID**.

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/image-44-1024x595.png "image 44 - Creating Google Calendar API Key")

## **Step 7: Configure Google Calendar in Modern Events Calendar**

The Google Calendar integration in MEC uses **different credentials depending on the action** you want to perform.

### **Import Events from Google Calendar (Into MEC)**

For **importing events** from Google Calendar into MEC, only the following are required:

*   **API Key**
*   **Calendar ID**

To configure this:

1.  Go to your WordPress dashboard.
2.  Navigate to MEC → **Import / Export** → **Google Cal. Import** tab.
3.  Enter your **API Key**.
4.  Enter the **Calendar ID**.

This method is used by MEC’s built-in **Import / Export** feature to fetch events from Google Calendar and **does not require OAuth authentication**.

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/image-38-1024x583.png "image 38 - Creating Google Calendar API Key")

### **Export Events to Google Calendar (From MEC)**

For **exporting events** from MEC to Google Calendar, Google requires authenticated access.  
This means you must use **OAuth credentials**, not just an API key.

For exporting, you need:

*   **Client ID**
*   **Client Secret**
*   **Calendar ID**

To configure this:

1.  Navigate to MEC → **Import / Expor**t → **Google Cal. Export** tab.
2.  Enter the **Client ID**, **Client Secret**, and **Calendar ID**.
3.  Click **Authenticate**.

After authentication, you may be redirected to a **Google login and permission screen**.  
This is expected behavior and means Google requires you to:

1.  Select your Google account
2.  Approve the requested access permissions

Once approved, MEC will be authorized to export events to your Google Calendar.

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/image-41-1024x575.png "image 41 - Creating Google Calendar API Key")

### **Using the Advanced Importer Addon**

If you are using the **Advanced Importer addon**, note that it uses **OAuth authentication** as well.

In this case:

*   **Client ID** and **Client Secret** must be configured **inside the Advanced Importer settings**
*   The Advanced Importer creates and manages **its own Google authentication**
*   Its OAuth setup is **separate from MEC’s Import / Export Google settings**

The Advanced Importer **only handles imports** and does **not reuse** the OAuth configuration from MEC’s Google Calendar Export.

![Creating Google Calendar API Key](https://webnus.net/dox/modern-events-calendar/wp-content/uploads/2021/05/image-35.png "image 35 - Creating Google Calendar API Key")

### **Important Notes**

• **API Key** + **Calendar ID** are used for importing events via MEC core.

• **Client ID** + **Client Secret** + **Calendar ID** are used for exporting events from MEC.

• **Advanced Importer** uses its **own OAuth configuration** and authentication flow and does not use the **API Key**.

• The **API Key** is only required for the Google Calendar **Import/Export** feature in MEC.

• Being redirected to Google for authentication does not mean the API Key has expired.

• It simply means Google requires permission approval for OAuth-based actions.