Describe the issue/error/question
I need to be able to make an http call with a “client certificate auth”. How can we o this in n8n cloud?
Was able to do so in make.com and using function node in self hosted version of n8n enabling axios and https libs
However the ideal scenario would be to have this auth method in the core code, same as you did for oauth2 and other auth methods.
Below the example code in the function node:
const https = require('https');
const axios = require('axios');
// agent
const agent = {
cert: "-----BEGIN CERTIFICATE-----\nABCD\nABCD\nABCD\nABCD\n-----END CERTIFICATE-----", //Saved in n8n credentials module
key: "-----BEGIN CERTIFICATE-----\nABCD\nABCD\nABCD\nABCD\n-----END CERTIFICATE-----", //Saved in n8n credentials module
rejectUnauthorized: false,
keepAlive: true,
passphrase: "andres"
}
// configure request
const options = {
url: "https://69bbef42e767352de8881ad0ca337f09.m.pipedream.net",
headers: {'Content-Type': 'application/x-www-form-urlencoded','Accept':'application/json','Authorization':'Bearer '+{{ACCESS.TOKEN}},'X-Client-Id':'OTHERCLIENTID'},
method: 'POST',
data : 'grant_type=client_credentials&scope=andresScope&client_id=XYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYGx&client_secret=IJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJA', ////Saved in n8n credentials module
httpsAgent : new https.Agent(agent),
}
try {
const response = await axios(options)
console.log(response.data);
return [{ json:response.data }]
}
catch (error) {
// console.log(error.response.body);
return [{ json: {'value':'error'} }]
}
Below some images on the way make.com resolved this:
Create HTTP type of call specific for cert auth:
Save cert and key in credentials module:
Idea on suggested way to implement in n8n UI
Maybe an extension of this commit?https://github.com/n8n-io/n8n/commit/e29c5975e1f1ad089167df46021203e9f67c8ef1
@jan @RicardoE105
Example from Postman Console:
Hope somebody can help us with this!
@Jon @MutedJam @milorad
Thanks!
Andres
Information on your n8n setup
- n8n version: 0.203.1
- Running n8n via [Docker, npm, n8n.cloud, desktop app]: PRO PLAN N8N CLOUD