šŸš€ Feature: OAuth2 Support for OpenAI (ChatGPT)

Problem
Today, OpenAI integration in n8n relies on API keys, which:

Don’t support user-level authentication
Don’t integrate with accounts that use subscriptions like ChatGPT Plus

:light_bulb: Proposed Solution
Add OAuth 2.0 authentication for OpenAI credentials.

Flow:
Click ā€œConnect with OpenAIā€
Redirect to OpenAI login/consent
Receive authorization code
Exchange for access/refresh tokens
Store securely and use in nodes

:fire: Why it matters
Secure authentication (no API keys)
Better UX
Enables usage tied to user accounts (e.g., ChatGPT Plus subscribers)

:brain: Use cases
Users who already pay for ChatGPT Plus and want native integration

Hi, I opened a draft PR that adds OAuth access token support to the existing OpenAI credential path for OpenAI chat/LLM nodes:

The current implementation is intentionally scoped to supporting OAuth/browser/headless-provided access tokens in the OpenAI credential and making the LangChain/OpenAI chat nodes use that token resolution path, while preserving API key support.

Feedback from the n8n team/community would be very welcome.

2 Likes