Vintner
Integrations

Git Providers

GitHub, GitLab, and Bitbucket OAuth integration with automatic token refresh.

Git Providers

Git provider integrations enable repository access for GitOps workflows. Three providers are supported via OAuth.

Supported Providers

ProviderAuth MethodToken Refresh
GitHubOAuth 2.0Automatic via refresh token
GitLabOAuth 2.0Automatic via refresh token
BitbucketOAuth 2.0 (Basic Auth for refresh)Automatic via refresh token

Connection Flow

Click Connect

Click "Connect" on the provider card in the Integrations page.

OAuth Authorization

You're redirected to the provider's authorization page. Grant the application access to your repositories.

Callback

The provider redirects back to Trellis with an authorization code. Supabase exchanges it for access and refresh tokens.

Token Storage

A database trigger copies the tokens from auth.identities to the provider_tokens table. All tokens are encrypted at rest by Supabase.

Token Refresh

Git tokens have limited lifetimes. The getValidProviderToken() server action handles refresh automatically:

  1. Reads the token from provider_tokens
  2. Checks expires_at — if in the past, initiates refresh
  3. Calls the provider's token refresh endpoint:
    • GitHub: POST github.com/login/oauth/access_token
    • GitLab: POST gitlab.com/oauth/token
    • Bitbucket: POST bitbucket.org/site/oauth2/access_token
  4. Updates the token in the database
  5. Returns the valid access token

This happens transparently whenever a Git operation is needed.

What Tokens Are Used For

  • Repository listing — the Plant a Vine form shows repos from your connected provider
  • ArgoCD access — after deploying, ArgoCD uses the token to watch repositories for changes
  • Template cloning — infrastructure templates can be sourced from your repositories

Disconnecting

Disconnecting a Git provider:

  1. Deletes the provider_tokens record
  2. Revokes the OAuth grant with the provider via Supabase unlink
  3. Existing ArgoCD installations that use this token will lose repository access

Disconnecting a Git provider affects all vines that use repositories from that provider. ArgoCD will show "sync failed" until a new token is provided.

On this page