Add PostHog Cloud OAuth and self-hosted support

PostHog Cloud authenticates via CIMD OAuth (public client, PKCE)
through the region-agnostic oauth.posthog.com gateway, with an API-key
fallback. PostHog Self-Hosted is a separate provider using an API key
and an instance URL.

The shared driver discovers the data region by probing us/eu for OAuth
connections, since the gateway does not serve the data API, and pins
pagination to the resolved host.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
Aurélien Sibiril
2026-05-29 12:24:21 +02:00
parent 6e65c56235
commit 3888ff95cd
10 changed files with 406 additions and 55 deletions

View File

@@ -91,6 +91,16 @@ type (
MetabaseConnectorSettings struct {
InstanceURL string `json:"instance_url"`
}
// PostHogConnectorSettings carries the data-API base host for both the
// cloud (POSTHOG) and self-hosted (POSTHOG_SELF_HOSTED) providers. It
// is the region-pinned host for API-key connections
// (https://us.posthog.com / https://eu.posthog.com / a self-hosted
// instance URL). It is empty for cloud OAuth connections — the driver
// then defaults to the region-agnostic gateway https://oauth.posthog.com.
PostHogConnectorSettings struct {
BaseURL string `json:"base_url"`
}
)
// GrantType returns the OAuth2 grant type recorded on the connector's