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
- Initiation: The user is redirected to the GitHub App installation page.
- Authorization: The user selects repositories and authorizes the app.
- Callback: GitHub redirects to
/github-installed, which then calls the/api/auth/githubendpoint. - Token Exchange: The backend exchanges the temporary
codefor an OAuth token and an Installation Access Token. - Storage: The provider details are stored via the
createProvideraction and linked to the userβs account.
GitLab OAuth Flow
Unlike GitHub Apps, GitLab uses a standard OAuth Application flow:
- Initiation: The user is redirected to GitLab to authorize the Sitepins application.
- Authorization: The user grants access to their projects and API.
- Callback: GitLab redirects to
/gitlab-installed, which calls/api/auth/gitlab. - Token Exchange: The backend exchanges the
codefor 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