How to Create an OAuth2 Connection to Google Drive from n8n
Creating a proper OAuth2 connection between n8n and Google Drive requires several steps. Follow this guide to set everything up correctly.
I personally would watch the video because you can see things on the screen. But this might help some people in any case.
Step 1: Start in n8n
First, begin in your n8n workflow:
Go to the Google Drive node
Click "Create new credential"
Select "OAuth2"
Copy the redirect URL that appears
Step 2: Set Up Google Cloud Project
Next, you'll need to create a project in Google Cloud:
Go to Google Cloud Console
Log in with your Google account
Click "Create new project"
Name your project (e.g., "my beautiful n8n THL G drive")
Add the date as a best practice to remember when it was created
Click "Create"
Step 3: Enable Required APIs
Once your project is created:
Select your project
Go to "APIs & Enabled Services"
Click "Library"
Search for and enable these APIs: (you can also do one by one as needed. I am just lazy to go back there again)
Google Drive API
Gmail API
Google Sheets API
YouTube Data API
Google Calendar API
Google Docs API
Google Forms API
Google Slides API
Now set up the consent screen:
Go to "Credentials"
Click "Create Credentials"
Select "OAuth client ID"
Click "Configure Consent Screen"
Choose "Internal" for the User Type
Enter app name (e.g., "n8n G Drive 2025-02-23")
Enter your email as support email
Add your email as developer contact
Click "Save and Continue"
Step 5: Create OAuth Credentials
After setting up the consent screen:
Go back to "Credentials"
Click "Create Credentials"
Select "OAuth client ID"
Choose "Web application" as the application type
Name it (e.g., "n8n")
Under "Authorized redirect URIs," paste the CALLBACK URL you copied from n8n
Click "Create"
Step 6: Connect n8n with Google
Finally, connect everything:
Copy the Client ID from Google Cloud
Paste it into n8n OAuth2 credential configuration
Copy the Client Secret from Google Cloud
Paste it into n8n OAuth2 credential configuration
Click "Sign in with Google"
Select your Google account
Allow the requested permissions
Wait for the "Connection is successful" message
Testing Your Connection
To verify everything works:
Set up a workflow with a trigger (e.g., Schedule trigger)
Add an HTTP request node to download a file
Add a Google Drive node to upload the file
Run the workflow and check if the file appears in your Google Drive
The file should appear with today's date in the filename
FAQ
Q: What if I need additional Google APIs later?
A: You can always go back to the Google Cloud Console, navigate to "Library" and enable additional APIs as needed.
Q: Why should I add the date to my project name?
A: Adding the date helps you track when connections were created. This makes it easier to manage multiple integrations over time.
Q: What's the difference between Internal and External user types?
A: Internal is for use within your organization only. External requires Google verification if you plan to make the app available to users outside your organization.
Q: How can I troubleshoot connection issues?
A: Check that all required APIs are enabled. Verify your redirect URI is correct. Ensure you've copied the Client ID and Secret correctly.