Skip to content

HTTP Request credentials#

You can use these credentials to authenticate the following nodes:

Prerequisites#

You must use the authentication method required by the app or service you want to query.

Existing credential types#

n8n recommends using this option whenever there's a credential type available for the service you want to connect to. It offers an easier way to set up and manage credentials, compared to configuring generic credentials.

You can use Predefined credential types to perform custom operations with some APIs where n8n has a node for the platform. For example, n8n has an Asana node, and supports using your Asana credentials in the HTTP Request node. Refer to Custom operations for more information.

Generic authentication#

The following generic authentication methods are available:

  • Basic Auth
  • Custom Auth
  • Digest Auth
  • Header Auth
  • OAuth1 API
  • OAuth2 API
  • Query Auth

You can learn more about HTTP authentication here.

Using an existing credential type#

To use a predefined credential type:

  1. Open your HTTP Request node, or add a new one to your workflow.
  2. In Authentication, select Predefined Credential Type.
  3. In Credential Type, select the API you want to use.
  4. In Credential for <API name>, you can:
    1. Select an existing credential for that platform, if available.
    2. Select Create New to create a new credential.

Refer to Custom API operations for more information.

Using Basic Auth or Digest Auth#

  1. Update the credential name.
  2. Enter the Username and Password for the app or service your HTTP Request is targeting.
  3. Select Save to save your credentials.

Using Header Auth#

  1. Update the credential name.
  2. Enter the header Name and Value required for the app or service your HTTP Request is targeting. Read more about HTTP headers.
  3. Select Save to save your credentials.

Using OAuth1#

  1. Update the credential name.
  2. Enter the following authentication details:
    • Authorization URL
    • Access Token URL
    • Consumer Key
    • Consumer Secret
    • Request Token URL
    • Signature Method
  3. Select Save to save your credentials.

Read more about OAuth1.

Using OAuth2#

  1. Update the credential name.
  2. Enter the following authentication details:
    • Authorization URL
    • Access Token URL
    • Client ID
    • Client Secret
    • Scope
    • Auth URI Query Parameters
    • Authentication
  3. Select Save to save your credentials.

Read more about OAuth2.

Using Custom Auth#

The Generic Auth Type > Custom Auth option expects JSON data to define your credential. You can use headers, qs, body or a mix. See the examples below to get started.

Sending two headers#

1
2
3
4
5
6
{
	"headers": {
		"X-AUTH-USERNAME": "username",
		"X-AUTH-PASSWORD": "password"
	}
}

Body#

1
2
3
4
5
6
{
	 "body" : {
		"user": "username",
		"pass": "password"
	}
}

Query string#

1
2
3
4
5
6
{
	"qs": { 
		"appid": "123456",
		"apikey": "my-api-key"
	}
}

Sending header and query string#

1
2
3
4
5
6
7
8
{
	"headers": {
		"api-version": "202404"
	},
	"qs": {
		"apikey": "my-api-key"
	}
}