node-add-oauth

Adds OAuth2 credential support to existing n8n nodes with tests and CLI constant updates.

Updated Apr 9, 2026
One-click install
npx skills add https://github.com/Uguryldz/n8nclean --skill node-add-oauth-uguryldz
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: node-add-oauth
Source: https://github.com/Uguryldz/n8nclean/tree/main/.claude/plugins/n8n/skills/node-add-oauth
Command: npx skills add https://github.com/Uguryldz/n8nclean --skill node-add-oauth-uguryldz

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @n8n/client-oauth2, nock, n8n-workflow.

What problem does it solve? Adding OAuth2 authentication to an existing n8n node involves many coordinated changes across credential files, node definitions, package registration, CLI constants, and tests. This Skill automates that entire workflow so nothing is missed. ## Core Features & Use Cases - Credential File Generation: Creates a standards-compliant OAuth2Api credential class with correct hidden fields, default scopes, and optional custom-scope support. - Node & GenericFunctions Updates: Wires the new credential into the node's credential array, version options, and request routing logic, including gateway-style services requiring site/cloud ID lookups. - Test & Verification Coverage: Generates credential tests using @n8n/client-oauth2 and nock, updates GenericFunctions.test.ts, and runs typecheck and lint verification. - Use Case: You maintain the n8n codebase and want to add OAuth2 support to the GitHub node with user-customizable scopes. Invoke the skill with the node name, and it produces the credential file, registers it in package.json, updates the CLI editable-scope constant, and writes passing tests. ## Quick Start Ask the assistant to run /node-add-oauth with the node name, for example: add OAuth2 support to the Notion node with custom scopes enabled.

Frequently Asked Questions about node-add-oauth

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add OAuth2 authentication to an existing n8n node?▼

Create an OAuth2Api credential class extending oAuth2Api with hidden authUrl and accessTokenUrl fields, register it in packages/nodes-base/package.json, then add the credential to the node's credentials array and version options. This skill automates all of these steps including tests.

How do I support custom OAuth2 scopes in n8n credentials?▼

Add a customScopes boolean toggle, an enabledScopes string field, and a scope expression that switches between user values and defaults. You must also add the credential name to GENERIC_OAUTH2_CREDENTIALS_WITH_EDITABLE_SCOPE in packages/cli/src/constants.ts, or n8n deletes custom scopes on reconnect.

Does this work with Atlassian-style gateway OAuth2 APIs?▼

Yes. For services where the token is scoped to a gateway URL rather than the instance URL, the skill adds a module-level site ID cache and a lookup helper that queries the accessible-resources endpoint, then constructs gateway URLs using the resolved site ID.

How are n8n OAuth2 credentials tested?▼

Tests use ClientOAuth2 from @n8n/client-oauth2 with nock for HTTP mocking. They verify metadata, default scopes in the authorization URI, token retrieval with mocked token endpoints, and custom scope behavior, with nock lifecycle hooks disabling real network connections.

Why does my n8n OAuth2 credential lose custom scopes on reconnect?▼

This happens when the credential name is missing from the GENERIC_OAUTH2_CREDENTIALS_WITH_EDITABLE_SCOPE array in packages/cli/src/constants.ts. Adding the credential name to that constant preserves user-defined scopes across OAuth2 reconnections.