Skip to content

Authentication

All custom proxy endpoints require a valid Forgejo personal access token. The proxy supports three authentication methods.

Method 1: Authorization Header (Preferred)

Section titled “Method 1: Authorization Header (Preferred)”

Pass the token in the Authorization header using the token scheme:

Terminal window
curl -H 'Authorization: token YOUR_FORGEJO_TOKEN' \
'https://forgejo-proxy.hochguertel.work/api/v1/repos/owner/repo/actions/runs/latest/logs'

This is the recommended approach and matches Forgejo’s own API convention.

Terminal window
curl 'https://forgejo-proxy.hochguertel.work/api/v1/repos/owner/repo/actions/runs/latest/logs?access_token=YOUR_FORGEJO_TOKEN'
Terminal window
curl 'https://forgejo-proxy.hochguertel.work/api/v1/repos/owner/repo/actions/runs/latest/logs?token=YOUR_FORGEJO_TOKEN'

The proxy enforces access control at the resource level. Before executing a custom endpoint, it verifies that the provided token has read access to the target repository or organisation using Forgejo’s standard API.

This means:

  • Your token must have at least repository read permission for repo-scoped endpoints
  • Your token must have at least organisation read permission for org-scoped endpoints
  • Only after this check passes does the proxy proceed with the requested operation

Some proxy endpoints interact with the Forgejo web UI (for example, Projects endpoints that have no REST API). These require the caller to supply Forgejo web credentials via request headers:

HeaderDescription
X-Webui-UsernameYour Forgejo username
X-Webui-PasswordYour Forgejo password

The proxy establishes a per-request session with these credentials — no admin credentials are stored server-side. Each request authenticates independently and the session is discarded after the response is returned.

Security implication: Credentials travel only within the individual HTTP request and are never persisted on the proxy server.

The thfg CLI sends these headers automatically when username and password are configured in the host entry (~/.config/thfg/config.json). No manual header management is required.

Terminal window
curl -H "Authorization: token $YOUR_TOKEN" \
-H "X-Webui-Username: youruser" \
-H "X-Webui-Password: yourpassword" \
https://forgejo-proxy.hochguertel.work/api/v1/repos/org/repo/projects
  1. Log in to your Forgejo instance
  2. Go to Settings → Applications → Manage Access Tokens
  3. Create a token with at least Repository: Read scope
  4. Copy the token — it is only shown once