Creating PEM credentials through API

I am trying to programmatically create JWT PEM credentials through n8n API.

The database schema for jwtAuth is as follows (retrieved from the credentials/schema/jwtAuth endpoint):

[
{
“additionalProperties”: false,
“type”: “object”,
“properties”: {
“keyType”: {
“type”: “string”,
“enum”: [
“passphrase”,
“pemKey”
]
},
“secret”: {
“type”: “string”
},
“privateKey”: {
“type”: “string”
},
“publicKey”: {
“type”: “string”
},
“algorithm”: {
“type”: “string”,
“enum”: [
“HS256”,
“HS384”,
“HS512”,
“RS256”,
“RS384”,
“RS512”,
“ES256”,
“ES384”,
“ES512”,
“PS256”,
“PS384”,
“PS512”,
“none”
]
}
},
“allOf”: [
{
“if”: {
“properties”: {
“keyType”: {
“enum”: [
“passphrase”
]
}
}
},
“then”: {
“allOf”: [
{
“required”: [
“secret”
]
},
{
“required”: [
“privateKey”
]
},
{
“required”: [
“publicKey”
]
}
]
},
“else”: {
“allOf”: [
{
“not”: {
“required”: [
“secret”
]
}
},
{
“not”: {
“required”: [
“privateKey”
]
}
},
{
“not”: {
“required”: [
“publicKey”
]
}
}
]
}
}
],
“required”:
}
]

The if/else statement in the schema means keyType of ‘passphrase’ requires the fields “privateKey”, “publicKey”, and “passphrase”. And if not (i.e. if the keyType is ‘pemKey’), it prohibits the above 3 fields. This is contrary to what is required when creating JWT PEM credentials as shown in the image below:

  • n8n version: 1.54.4
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: Windows 11

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hey @douglassshufelt,

Welcome to the community :tada:

This looks like it is a validation issue with the API, We have an internal dev ticket for this which we have been tracking as PAY-1355. I have added this to it so when we fix it you will be notified.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.