Integrating Google Drive API with MuleSoft

Prerequisites

Before integrating Google Drive with MuleSoft, ensure you have the following accounts, tools, and environment ready:

1. Google Requirements

  • A Google Account (Gmail or Workspace)

  • Access to Google Developer Console

  • Permission to create:

    • Projects

    • OAuth Consent Screen

    • OAuth 2.0 Credentials

    • API Enablement (Google Drive API)

2. MuleSoft Requirements

  • Anypoint Studio installed

    • Recommended version: 7.x or later

  • Mule Runtime 4.x

  • Internet access for downloading connectors from Anypoint Exchange

3. Google Drive Connector

  • The Google Drive Connector downloaded from MuleSoft Exchange

4. Project & Authorization Requirements

  • A running Mule application with an HTTP Listener

  • A Redirect URI that you will configure in both Google Developer Console & MuleSoft:

    http://localhost:8081/authorize

5. Basic Knowledge Requirements

  • Understanding of:

    • HTTP connectors

    • OAuth 2.0 Authorization Code flow

    • Mule Properties & Secure configuration (Client ID/Secret handling)

    • Anypoint Studio flows

Content

Integrating Google Drive with MuleSoft allows you to automate file uploads, downloads, sharing, and organization. This guide walks you through every step—from setting up the Google Developer Console to configuring MuleSoft with OAuth 2.0 to interact with Google Drive.

Part 1: Google Developer Console Setup

1. Create a Project in Google Developer Console

  1. Open the Google Developer Console.

  2. Click “Select a project”“New Project”.

  3. Enter your project name and click Create.

step1

2. Create OAuth 2.0 Credentials

  1. Go to the Credentials tab in the left-hand menu.

  2. Click “Create Credentials” → “OAuth 2.0 Client ID”.

step2

3. Create OAuth Consent Screen

If this is your first OAuth setup, Google will prompt you to create a consent screen.

  1. Select “OAuth consent screen.”

  2. Enter required fields:

    • Application name

    • User support email

    • Developer contact email

  3. Choose External if users outside your organization will access the app.

  4. Click Save and Continue.

4. Create OAuth Client ID

  1. Under “Create OAuth client ID”, choose Web application.

  2. Add the following in Authorized redirect URIs:http://localhost:8081/authorize

  3. Click Create.

step3

step4

5. Obtain Client ID and Client Secret

After creating the OAuth Client:

  • Copy the Client ID

  • Copy the Client Secret

You will use these values inside MuleSoft.

6. Enable Google Drive API

  1. Go to the Library section.

  2. Search “Google Drive API”.

  3. Click it → press Enable.

step5

Part 2: MuleSoft Configuration

1. Download Google Drive Connector

In Anypoint Studio:

  1. Open the Exchange tab.

  2. Search Google Drive Connector.

  3. Download and add it to your Mule project.

2. Configure Google Drive Connector in MuleSoft

  1. Drag the Google Drive connector into your flow (e.g., Drive Files List operation).

  2. Enter the required fields:

  • Client ID – from Google Developer Console

  • Client Secret – from Google Developer Console

  • Redirect URI : http://localhost:8081/authorize

3. Handle OAuth Authorization

Run your Mule application and open : http://localhost:8081/authorize

This triggers:

  1. Google login page

  2. User permission (Google Drive scope request)

  3. Google redirects back to: http://localhost:8081/authorize

  4. Mule exchanges the authorization code for:

    • Access Token

    • Refresh Token

step6

4. Use the Google Drive API in MuleSoft

After authorization, you can perform actions such as:

  • List files

  • Upload documents

  • Download files

  • Create new folders

  • Delete files

Simply add the respective Google Drive connector operations in your flow.

step7

FAQs

1. Do I need a paid Google account to use the Google Drive API with MuleSoft?

No, a paid account is not required. You can use a free Gmail account to create a Google Cloud project, enable the Drive API, and generate OAuth credentials. However, business-level Google Workspace accounts may offer better quota and security features.

The redirect URI is where Google sends the authorization code after the user logs in.
It must match exactly in both:

  • Google Developer Console

  • MuleSoft Google Drive Connector configuration

If they don’t match, authentication will fail with a redirect_uri_mismatch error.

Technically yes, but it is not recommended.
You should store them securely using:

  • Mule Secure Property Placeholder

  • Encrypted properties

  • Secrets manager of your deployment environment

This prevents accidental exposure or commits to Git repositories.

Common reasons include:

  • Authorization not completed successfully

  • Wrong scopes granted during OAuth setup

  • Using a different Google account than the one used during authorization

  • Access token expired (use Refresh Token for regeneration)

Make sure the app has Google Drive scope permissions and that the user authorized correctly.

Yes, MuleSoft can upload and download large files via the connector.
However, limitations depend on:

  • Google Drive API upload size limits

  • MuleSoft runtime memory configuration

  • Network conditions

For files over 5MB, Google uses resumable uploads, so ensure the connector operation supports it or implement chunked processing.