Google Drive Connector in MuleSoft
Pre-requisites
- We need to have an Anypoint Studio should be setup.
- A Google account is required to access Google Cloud Console.
- Create a project in Google Cloud Console (console.google.com).
- Steps to enable Google Drive APIs and create a client.
Steps:
1. Navigate to https://console.cloud.google.com , open the project picker located at the top of the page, and click on New Project to create a new project.


2. Provide a name for the project and click Create to proceed.

3. Next, click on the Navigation menu (☰) in the top-left corner, then select APIs & Services from the list of available options.

4. Next, click on Enable APIs and Services, then use the search bar to locate Google Drive API, and select it from the results, and enable it.



5. Then, click on create credentials and select the OAuth Client ID.

6. Click on Create Credentials and select OAuth Client ID from the available options.

7. Enter the App name, User support email, and select the User type as External. Provide a valid Developer contact email, agree to the Terms of Service, and click Next to proceed. Lastly, click on create to create the project.




8. Then, navigate to the Audience tab and click Add User to include the desired user.

9. Next, navigate to the Clients tab and create a new OAuth 2.0 Client ID.

10. Configure the application type as a web application, name the client, and provide the redirect URIs.

11. Click on Create and download the JSON file, which will contain the client_id and client_secret.

Google Drive Connector
- Google Drive is a file storage and synchronization service created by Google. It allows users to store files in the cloud, share files, and edit documents, spreadsheets, and presentations with collaborators.
- The Anypoint connector for Google Drive enables you to simplify repetitive tasks by automating how you convert, sync and share folders and files across all of your cloud storage services. Now you can automate file processing, transfers and sharing, ranging from very simple tasks to the most complex and challenging workflows.
Associated Use Cases:
- Automate common business operations by integrating Google Drive with other business applications such as CRM, ERP, DocuSign, and so on. Possibilities include:
- Backup and archive critical data :- Leverage the Google Drive connector to seamlessly integrate with your CRM like Salesforce, your ERP like SAP, EDI, and fulfillment systems, to archive necessary data.
- Enable efficient Sales processes :- Enable two-way, real-time synchronization between your CRM like Salesforce and Google Drive to ensure that any changes made to a file can be reflected on both platforms.
- Automate pre-built ITSM workflows :- Boost productivity for your IT teams by connecting ServiceNow and Google Drive to automate your tickets, user management, and IT operations.
- Increase productivity :- Connect your workplace productivity apps such as Microsoft Teams or Slack to Google Drive to update documents, add comments to documents, and share files without switching context.
Steps:
- To begin, a new Mule project needs to be created. Then, a HTTP listener component dragged and dropped into the project from the HTTP module. Configure the listener, and set the host to All interface (0.0.0.0), port number as 8081. Set the path as /drive.

- Following the addition of the listener component, include two loggers to mark the beginning and the end of the flow. By logging the message “Start of flow” ++ (flow.name as String), in expression mode.

- Next, go to Search in Exchange, search for Google Drive Connector, select it from the results, click Add/Install, complete the installation

- Now, Drag Drive files list component from google drive module and start configure the connector configuarations. There is no need to configure the General section, as it is only used for filtering the files being fetched. we’ll reference the consumer key and consumer secret using secure property placeholders, which allows us to keep sensitive credentials encrypted and externalized from the main codebase.
Connector configuration: Add the consumer key, consumer secret (from the JSON file). Add the necessary scopes, configure the OAuth Callback and configure object store for refresh token.
(Note: Use the callback URL, which you configured while enabling the Google Calendar APIs).



Access Type:
- Offline
It requests a refresh token from Google, allowing the connector to access the drive even when the user is not present. If this is not used, the refresh token capability will not be present.
- Online
It requests a short-lived access token from Google. If the token expires, the user needs to log in again
Prompt:
It instructs Google to force the user to re-consent to the requested scopes, even if they’ve already granted permission before.
- Consent:
It ensures that the Google Drive connector gets a fresh refresh token and scopes are confirmed every time the OAuth flow is triggered. (adding new scope-helpful)
- Select_account:
It prompts the user to choose an account (if multiple accounts – helpful)
- None:
No consent is needed, whatever the scopes are provided, only those will be configured.
Consumer key:
- Identifies your app to Google’s OAuth server.
Consumer Secret:
- Authenticates your app during the token exchange.
Authorization URL:
- This is the URL where the user is redirected to give consent and log in.
Access Token URL:
- This endpoint is used to get the access token.
Callback URL:
- This is the path where Google redirects the user after they approve access.
Scopes:
- Defines what level of access your app is requesting.
- Permissions.
Object Store:
- Stores the access and refresh tokens.
- Then, we’ll drag and drop a transform message component to transform the payload into JSON format .

- Now pass the runtime arguments mule.env and mule.key, then run the application. Open your browser and navigate to http://localhost:8081/authorize to initiate the authorization process. Enter your credentials to authenticate and generate the access token.



- Now open Postman, use the URL http://localhost:8081/drive with the GET method, and send the request. You will receive an array of file details as the response.

Ready to Automate Your Enterprise Workflows with MuleSoft?
If you’re planning to integrate platforms like Google Drive into your enterprise ecosystem, TGH can help you design and implement scalable, secure, and future-ready MuleSoft integrations.
From workflow automation to API-led connectivity — our experts ensure seamless enterprise data flow.
📩 Get expert consultation today:
👉 https://techygeekhub.com/contact-us/
Or connect with us directly:
🌐 Website: www.techygeekhub.com
📧 Email: info@techygeekhub.com
📞 Phone: +91 8810610395
Let’s build your connected enterprise with TGH.
