How do I connect n8n workflows with external APIs that require OAuth2 authentication?

If I want my n8n workflow to get data from or send data to another app or service that uses OAuth2 login (like Google, GitHub, Salesforce, etc.), how do I set up that connection in n8n?

You’ll need to use the specific nodes for the services you want to connect to, like the Google Sheets node or the GitHub node. These nodes have built-in support for OAuth2. You’ll authenticate by clicking “Connect Account” within the node’s settings, which will prompt you to log in and grant permissions. This creates the necessary access tokens for your workflow to interact with the external service.

Hi Suheb

If i understand correctly, you’re looking for information on setting up credentials.

N8N Docs have a compiled list of predefined credentials: Credentials library | n8n Docs, where services like Google is represented: Google credentials | n8n Docs

You can use these credentials with custom API calls as well: Custom API actions for existing nodes | n8n Docs

Let me know if this helps or if you need more information to get started :slight_smile:

Hi @Suheb,

The simplest way is to use the credential drop down from the specific app node or http node like this:

For official app nodes which exist like Google and Github as an example, you can create the credential dropdown and then select create new:

This will then present you with Auth options where OAuth might be an option. Fill out the details and the credential will be created and linked to the node

In cases where you need to call 3rd party REST APIs which requires OAuth, select the below properties and then create new credential

From here fill out the necessary fields. At any point if you need more help on how to setup the 3rd party app details, you can select the “Open docs” link at the top of the credential form

1 Like