@reforma/siwc-bridge
v0.0.1
Published
Bridge Sign in with ChatGPT loopback callbacks to remote backends, Docker environments, and VMs
Readme
@reforma/siwc-bridge
A small callback bridge for Sign in with ChatGPT.
OpenAI redirects the browser to an approved URL or to a loopback address such as http://127.0.0.1:<port>/auth/callback. That can be inconvenient when the backend handling the authorization flow runs somewhere else—for example, in Docker, on a development hostname, or on a remote VM.
@reforma/siwc-bridge runs a small HTTP listener on the machine where the browser is open. It receives the loopback callback and redirects the browser to your backend endpoint, preserving the complete query string, including parameters such as code and state.
It is useful for:
- remote and self-hosted development environments;
- applications running in Docker or on VMs;
- development hostnames that cannot receive the OpenAI callback directly;
- architectures where the browser and the backend completing authorization run on different machines.
OpenAI
↓
http://127.0.0.1:1455/auth/callback
↓
@reforma/siwc-bridge
↓
https://your-backend.example/auth/openai/callbackThe package does not exchange, store, or modify credentials. It only redirects the callback from the local loopback listener to the endpoint you configure.
Usage
Start the bridge and point --api at the full URL of your backend callback endpoint:
npx @reforma/siwc-bridge \
--api https://api.example/auth/openai/connect/callbackBy default, the bridge listens at:
http://127.0.0.1:1455/auth/callbackIf your authorization request uses a different loopback URI, pass the same value with --redirect-uri:
npx @reforma/siwc-bridge \
--redirect-uri http://127.0.0.1:3000/auth/callback \
--api https://api.example/auth/openai/connect/callbackYour application must use the same loopback URI as its redirect_uri when starting the OpenAI authorization flow.
How it works
- Your application starts the Sign in with ChatGPT flow with a loopback
redirect_uri. - The user signs in and approves access.
- OpenAI redirects the browser to the loopback callback on the browser's machine.
@reforma/siwc-bridgereceives the callback.- It redirects the browser to the configured
--apiendpoint with the original query string intact. - Your backend validates
stateand exchanges the authorization code as usual.
This follows the general pattern in OpenAI's guide for remote and self-hosted environments.
Use Sign in with ChatGPT only where permitted by OpenAI's terms and documentation. This package is intended for open-source projects, development, testing, and supported remote-environment workflows.
Requirements
Node.js 24 or newer.
