Skip to Content
πŸ“¦ GitHub App Installation

Git App Installation

Sitepins uses a unified installation flow for Git providers to ensure that repositories are correctly linked to Sitepins Organizations.

GitHub Installation Flow

  1. Initiation: The user is redirected to the GitHub App installation page.
  2. Authorization: The user selects repositories and authorizes the app.
  3. Callback: GitHub redirects to /github-installed, which then calls the /api/auth/github endpoint.
  4. Token Exchange: The backend exchanges the temporary code for an OAuth token and an Installation Access Token.
  5. Storage: The provider details are stored via the createProvider action and linked to the user’s account.

GitLab OAuth Flow

Unlike GitHub Apps, GitLab uses a standard OAuth Application flow:

  1. Initiation: The user is redirected to GitLab to authorize the Sitepins application.
  2. Authorization: The user grants access to their projects and API.
  3. Callback: GitLab redirects to /gitlab-installed, which calls /api/auth/gitlab.
  4. Token Exchange: The backend exchanges the code for a long-lived access token and a refresh token.

Provider Data (createProvider)

Regardless of the provider, Sitepins standardizes the storage of Git access:

await createProvider({ provider: "Github" | "Gitlab", access_token: string, refresh_token: string, installation_token?: string, // GitHub only // ...other metadata });

Post-Installation

Once installed, the user can:

  • Discover Repositories: Browse available repos in the project creation flow.
  • Configure Projects: Set up a new Sitepins project by selecting a repository, branch, and content root.
  • Start Editing: Access the visual and code editors immediately.
Last updated on