Skip to content

docs(oauth): surface and document GitLab login support#195

Merged
appleboy merged 6 commits into
mainfrom
worktree-gitlab
May 21, 2026
Merged

docs(oauth): surface and document GitLab login support#195
appleboy merged 6 commits into
mainfrom
worktree-gitlab

Conversation

@appleboy
Copy link
Copy Markdown
Member

@appleboy appleboy commented May 21, 2026

Summary

GitLab OAuth login has been fully implemented and tested in the codebase since PR #70 (provider in internal/auth/oauth_gitlab.go, config fields, bootstrap registration, login button + tests), but the documentation and .env.example never caught up — so operators could not discover or configure it, and some text actively described GitLab as a future addition. This PR closes that documentation/config gap. No code, templates, or tests change.

  • Add a GitLab section to .env.example and the configuration guide (GITLAB_OAUTH_ENABLED, GITLAB_URL, GITLAB_CLIENT_ID, GITLAB_CLIENT_SECRET, GITLAB_REDIRECT_URL, GITLAB_SCOPES)
  • Add a dedicated GitLab OAuth Setup section and env-var reference rows to docs/OAUTH_SETUP.md
  • List GitLab as a supported provider across README.md, CLAUDE.md, and the docs; fix the stale "Easy to add GitLab" line
  • Rewrite the "adding a provider" tutorial off the now-built-in GitLab onto a Google example aligned with the current architecture
  • Follow-up corrections from review: complete GitLab provider lists in docs/ARCHITECTURE.md, docs/METRICS.md, docs/USE_CASES.md; fix the OAuth route paths in CLAUDE.md; correct the GitLab application UI path; clarify read_user returns the primary email; scope auth_login_total's auth_source label to local/http_api; correct the post-login redirect target; and clarify that same-email account linking requires a provider-verified email (GitLab/Gitea are unverified)

AI Authorship

  • AI was used. Details:
    • Tool / model: Claude Opus 4.7 (1M context) via Claude Code, plan-mode workflow (plan saved at ~/.claude/plans/support-gitlab-login-ancient-balloon.md)
    • AI-authored files: all 8 in the diff — .env.example, CLAUDE.md, README.md, docs/ARCHITECTURE.md, docs/CONFIGURATION.md, docs/METRICS.md, docs/OAUTH_SETUP.md, docs/USE_CASES.md
    • Human line-by-line reviewed: all 8 files reviewed line-by-line by the author before merge

Change classification

  • Leaf node — documentation/config only. No executable code, no behavior change. Failure mode is "docs are wrong/incomplete"; no system-wide impact.

Plan reference

Goal: make the already-working GitLab provider a first-class, discoverable, documented option. Operators can find GITLAB_* settings in .env.example, follow a real GitLab setup section in the docs, and provider lists no longer omit GitLab or describe it as hypothetical. No functional changes. (Plan: ~/.claude/plans/support-gitlab-login-ancient-balloon.md.)

Verification

  • All values sourced from the existing implementation: default GITLAB_URL=https://gitlab.com and default scope read_user match internal/config/config.go and auth.NewGitLabProvider.
  • go test ./internal/auth/... → ok (no code touched; GitLab provider tests still pass).
  • Consistency sweep: grep confirms every provider list naming GitHub/Gitea/Microsoft now also names GitLab, and no remaining text claims GitLab is unsupported / "to be added".
  • Doc claims cross-checked against code: route paths (internal/bootstrap/router.go), metric labels (RecordLogin / RecordOAuthCallback call sites), redirect target (oauth_handler.go), and email-verified linking gate (internal/services/user.go).
  • Note: go build ./... fails only on the generated api (Swagger) package, which requires make generate in a fresh worktree — pre-existing and unrelated to this diff.

Reviewer manual check: render the docs diff in GitHub preview; confirm the new "GitLab OAuth Setup" section reads consistently with the GitHub/Gitea sections, and that the rewritten "Adding More OAuth Providers" example no longer references built-in GitLab.

Risk & rollback

  • Risk: None functional. Doc/config-only. Worst case: wording or an example is unclear.
  • Rollback: git revert — content-only commits.

Reviewer guide

  • Read carefully: the new ## GitLab OAuth Setup section and the rewritten ## Adding More OAuth Providers section in docs/OAUTH_SETUP.md, plus the email-linking and metrics-label clarifications — these are the substantive prose to sanity-check against the implementation (internal/auth/oauth_gitlab.go, internal/bootstrap/oauth.go, internal/services/user.go).
  • Spot-check OK: the one-line provider-list additions in README.md, CLAUDE.md, docs/ARCHITECTURE.md, docs/METRICS.md, docs/USE_CASES.md, docs/CONFIGURATION.md, and the .env.example block (mirrors the existing Gitea block).

🤖 Generated with Claude Code

- Add a GitLab OAuth section to .env.example and the configuration guide
- Add a dedicated GitLab OAuth setup section and env-var reference rows
- List GitLab as a supported provider across the README and project docs
- Rewrite the "adding a provider" example off the now-built-in GitLab onto Google
Copilot AI review requested due to automatic review settings May 21, 2026 08:30
@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Surfaces already-implemented GitLab OAuth login support by updating operator-facing documentation and example configuration, and removes stale language implying GitLab is a future addition.

Changes:

  • Add GITLAB_* environment variables to .env.example and the configuration docs.
  • Extend provider lists across docs to include GitLab and update OAuth-related prose/tutorials accordingly.
  • Add a GitLab-specific setup section and env-var reference rows to docs/OAUTH_SETUP.md.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
README.md Updates provider lists and the OAuth setup guide link description to include GitLab.
docs/OAUTH_SETUP.md Adds GitLab setup steps, GitLab env-var reference rows, and rewrites the “adding a provider” tutorial.
docs/CONFIGURATION.md Documents GitLab OAuth env vars and updates supported-provider text.
CLAUDE.md Updates internal docs/provider lists to include GitLab.
.env.example Adds a GitLab OAuth configuration block for discoverability.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CLAUDE.md Outdated
Comment thread docs/OAUTH_SETUP.md Outdated
Comment thread README.md Outdated
appleboy added 2 commits May 21, 2026 16:52
- Fix the GitLab application UI path and add the localhost HTTPS redirect caveat
- Clarify that read_user returns the account primary email, not the public email
- Use an inline endpoint in the add-a-provider example to avoid an extra dependency
- Add GitLab to the architecture, metrics, and use-case provider lists
- Correct the OAuth route paths documented in CLAUDE.md
- Scope the OAuth setup guide features to GitHub, Gitea, and GitLab walkthroughs
- Point Microsoft Entra ID mentions to the configuration guide instead of implying coverage
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread docs/METRICS.md
Comment thread docs/OAUTH_SETUP.md Outdated
- Scope auth_login_total auth_source to local and http_api, matching RecordLogin call sites
- Describe the real post-login redirect (saved target or /account/sessions) instead of /device
@appleboy appleboy requested review from Copilot and removed request for Copilot May 21, 2026 09:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Comment thread docs/METRICS.md
Comment thread docs/OAUTH_SETUP.md
Comment thread CLAUDE.md
- Note that same-email auto-linking only occurs for providers attesting verified email
- Call out that GitLab and Gitea are treated as unverified and are not auto-linked
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

docs/OAUTH_SETUP.md:230

  • This example implies GitHub+Gitea+GitLab can all be linked to the same AuthGate account. In the current implementation, GitLab and Gitea always report EmailVerified=false and therefore cannot be auto-linked by email; if an account already owns that email, an unverified provider login (with no existing OAuthConnection) fails due to the UNIQUE email constraint. Consider revising the example to avoid showing multiple unverified providers linked to the same account, or explicitly describe the ordering/limitation (e.g., start with one unverified provider account, then link verified providers).
  - Local auth: alice / password123
  - GitHub: alice-github (linked)
  - Gitea: alice-work (linked)
  - GitLab: alice-gitlab (linked)

All methods log into the same AuthGate account.

Comment thread docs/OAUTH_SETUP.md Outdated
Comment thread docs/CONFIGURATION.md Outdated
- Clarify unverified providers (GitLab, Gitea) sign in only to accounts already holding their connection
- Note same-email creation fails on the unique-email constraint rather than making a separate account
- Rework the multiple-provider scenario to show verified-email providers, since unverified ones cannot auto-link
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

@appleboy appleboy merged commit 2e9516b into main May 21, 2026
21 checks passed
@appleboy appleboy deleted the worktree-gitlab branch May 21, 2026 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants