How gohighlevel/oauth-demo works
This small Express demo shows a developer-facing GHL OAuth flow: a user starts authorization, GHL returns an authorization code to the callback route, and the app exchanges it for token data. A separate refresh route exchanges a supplied refresh token. Configuration supplies client credentials and the authorization base URL. The excerpts show route registration and outbound requests; they do not show token persistence or broader API use.
Main entry points: callback.js Code exchange · index.js HTTP server · refresh.js Refresh exchange · initiate.js Start authorization
Components 8
Express server
- HTTP server
index.js - OAuth config
config.json
OAuth handlers
- Start authorization
lib/initiate.js - Code exchange
lib/callback.js - Refresh exchange
lib/refresh.js
GHL services
- GHL authorization
- GHL token endpoint
Other components
- User
Connections 13
- User → HTTP server: requests routes
index.js - HTTP server → Start authorization: routes /initiate
index.js - HTTP server → Refresh exchange: routes /refresh
index.js - HTTP server → Code exchange: routes callback
index.js - Start authorization → OAuth config: reads settings
lib/initiate.js - Code exchange → OAuth config: reads credentials
lib/callback.js - Refresh exchange → OAuth config: reads credentials
lib/refresh.js - Start authorization → GHL authorization: redirects user
lib/initiate.js - GHL authorization → Code exchange: returns code
- Code exchange → GHL token endpoint: exchanges code
lib/callback.js - Refresh exchange → GHL token endpoint: exchanges token
lib/refresh.js - Code exchange → User: returns token data
lib/callback.js - Refresh exchange → User: returns token data
lib/refresh.js