n8n-nodes-openai-browser-flow
v0.1.9
Published
Experimental browser-based OAuth flow for OpenAI usage in Node and n8n.
Maintainers
Readme
n8n-nodes-openai-browser-flow
Experimental Node/TypeScript community node package for n8n, with a companion local auth bridge for testing an OpenAI browser login flow and then calling the Responses API with the returned bearer token.
This package is intended for local experiments and custom n8n integrations. It now includes an actual n8n node, but it still does not guarantee that OpenAI browser login tokens are valid for https://api.openai.com/v1/responses.
What it does
- uses the n8n OAuth2 connect button against a local auth bridge
- lets the local bridge do the real Authorization Code + PKCE flow with OpenAI
- sends
POST /v1/responseswithAuthorization: Bearer <token> - exposes an n8n node named
OpenAI Browser Flow
Install
npm install n8n-nodes-openai-browser-flowBasic usage
import { OpenAIBrowserFlowClient } from 'n8n-nodes-openai-browser-flow';
const client = new OpenAIBrowserFlowClient({
clientId: 'YOUR_CLIENT_ID',
clientSecret: 'OPTIONAL_CLIENT_SECRET',
authorizationEndpoint: 'https://auth.openai.com/authorize',
tokenEndpoint: 'https://auth0.openai.com/oauth/token',
scopes: ['openid', 'profile', 'offline_access'],
audience: 'https://api.openai.com',
redirectHost: '127.0.0.1',
redirectPort: 3456,
redirectPath: '/callback',
});
await client.authenticate();
const response = await client.createResponse({
model: 'gpt-4.1-mini',
input: 'Diga oi em portugues.',
});
console.log(response.outputText);n8n usage
After installing the package as a community node, n8n should load:
- a credential type named
OpenAI Browser Flow API - a node named
OpenAI Browser Flow
The node exposes two operations:
Create Response: calls the OpenAI Responses API
The credential uses the standard n8n OAuth2 connection flow, but it is expected to point to a local bridge server instead of OpenAI directly.
Local bridge
A companion Flask bridge is expected at:
/home/gabrieldossantospeixoto/Documentos/GitHub/PESSOAL/openai-auth-bridge
Run that bridge first, then configure the credential with:
Authorization URL:http://localhost:1455/oauth/authorizeAccess Token URL:http://localhost:1455/oauth/tokenApp ID: your OpenAIapp_...idClient Secret: hidden and empty by default
The bridge completes the real OpenAI login on http://localhost:1455/openai/callback and hands the resulting token payload back to n8n.
The reusable library can also be used by:
- an internal helper package used by a node
- a Code node, if the runtime allows loading external packages
Important limitations
- browser/OAuth support for OpenAI API access is not validated by this package
- the returned token may be valid only for identity, not for
v1/responses - OpenAI may require a different audience, scope, redirect, or app registration flow
- this package now expects the OAuth connection to be completed through the n8n credential UI backed by the local Flask bridge
API
new OpenAIBrowserFlowClient(config)
Config fields:
clientId: OAuth client idclientSecret: optional client secretauthorizationEndpoint: defaults tohttps://auth.openai.com/authorizetokenEndpoint: defaults tohttps://auth0.openai.com/oauth/tokenscopes: defaults toopenid profile offline_accessaudience: optional audienceredirectHost: defaults to127.0.0.1redirectPort: defaults to3456redirectPath: defaults to/callbackopenBrowser: defaults totruecallbackTimeoutMs: defaults to 5 minutesapiBaseUrl: defaults tohttps://api.openai.com/v1
Methods:
authenticate()setAccessToken(accessToken)createResponse(request)
Bridge repository
The local bridge repository lives at:
/home/gabrieldossantospeixoto/Documentos/GitHub/PESSOAL/openai-auth-bridge
