Gitee integration

OAuth login + repository PAT + Webhook; Gitee's signature verification and Issue write API differ from GitCode and GitHub.

Gitee has two independent paths in Grape:

  • Login: Gitee OAuth, identity only, with no repository write permission
  • Repository hosting: Gitee PAT + Webhook, responsible for reading and writing Issues/PRs, creating repositories, and event ingestion

Do not use the login token as a repository token.

Integration steps

Step What to do Completion criteria
Step 1 Create an OAuth app in Gitee and register the callback URL Obtain client_id / client_secret
Step 2 Enter the Gitee credentials under Login channels Gitee appears on the login page
Step 3 Configure the Gitee PAT under Code hosting platforms Issue comments are authored by the account that owns the token
Step 4 Host the repository and confirm the WebHook The WebHook returns 200 and events reach Grape
Step 5 Create an Issue or a comment, and confirm events and the Pipeline The event appears on the Events page and the Pipeline can start

Gitee third-party application entry: create an application

Step 1: Create a Gitee OAuth app

Create an OAuth app in Gitee and set the callback URL to:

https://<your-domain>/api/auth/callback/gitee

Use the channel card default user_info for scope. Gitee does not support PKCE, so pkce_enabled must be false. Record client_id and client_secret.

Step 2: Configure the login channel

Enter the Gitee client_id / client_secret under Admin → Login channels. The values are encrypted in the database after you save. Do not write credentials to configs/oauth-providers.json.

Step 3: Configure the repository PAT

Create a PAT in Gitee under Settings → Private tokens, then configure it in Code hosting platforms → Gitee card. Gitee clone authentication uses basic_password: the username must be the login of the account that owns the token, and the token serves as the password.

Step 4: Host the repository and confirm the WebHook

Grape creates the WebHook automatically when you host a repository. When you add one manually, enter the following under the repository Manage → WebHooks:

https://<your-domain>/webhook/gitee

The Gitee WebHook "password" must equal that repository's webhook_secret. Verification is a plaintext password comparison, not HMAC.

Step 5: Verify events and write operations

Create an Issue or comment on one in a hosted repository: the WebHook test returns 200, the record appears on the Grape Events page, and the Issue comment author is the account that owns the token.

Prerequisites

What you need Why How to confirm
An account that can create Gitee OAuth apps and private tokens Login and repository write operations use two separate sets of credentials The Gitee settings page can create apps and generate private tokens
The platform's public domain Both the OAuth callback and the webhook must register a public address configs/server-config.json or server_base_url in the admin console
Admin console permission The login channel and the code hosting platform card are both configured in Admin You can open Login channels or Code hosting platforms

OAuth app (user login)

Where to configure: the gitee channel card is in configs/oauth-providers.json; client_id / client_secret are entered under Login channels and stored encrypted. Do not write them to the configuration file.

  • Set the Gitee OAuth app callback URL to https://<your-domain>/api/auth/callback/gitee
  • Use the channel card default user_info for scope
  • Gitee does not support PKCE; pkce_enabled in the channel card must be false

How to verify: the Grape login page shows the Gitee entry → select it → after Gitee authorization you return to Grape and log in successfully. The OAuth configuration is correct.

The login token is only for identity and never falls back to repository write permission; repository reads and writes use the PAT below.

Repository PAT (read, write, and hosting)

Where to configure: Code hosting platforms → Gitee card. Create the private token in Gitee under Settings → Private tokens and grant the repository, Issue, PR, and webhook permissions that the platform card requires.

  • Gitee clone authentication is basic_password: the clone username must be the login of the account that owns the token, and the token is the password
  • Gitee has no separate managed_repos physical column; repository credentials and webhook credentials both live in the repository credential table
  • Creating a repository and closing an Issue use owner-level endpoints (/repos/{owner}/issues plus repo in the body), unlike GitHub's /repos/{owner}/{repo}/issues

How to verify: have an Agent post an Issue comment in a hosted repository. If the comment appears in Gitee and the author is the account that owns the token, the PAT works.

Webhook (event ingestion)

Gitee's receiving path is fixed:

POST /webhook/gitee

How to configure:

  • Grape creates the webhook automatically when you host a repository; when you add one manually, enter https://<your-domain>/webhook/gitee under Manage → WebHooks in the Gitee repository
  • The Gitee WebHook "password" must equal that repository's webhook_secret
  • Gitee verification is a plaintext password comparison (token_compare), not HMAC; do not apply GitHub's Secret rules
  • The event header is X-Gitee-Event, and the payload uses the gitee_v5 dialect

How to verify:

  1. Select Test in the Gitee WebHook details → it returns 200
  2. Create or comment on an Issue in that repository → the event appears on the Grape Events page and triggers the Pipeline

If the test returns 403, first check whether the Gitee password and that repository's webhook_secret are identical; do not suspect the event type first.

What success looks like

If you do this You should see Evidence
Open the login page The Gitee entry appears Button on the login page
Log in with Gitee You reach the Workbench after the callback to /api/auth/callback/gitee Browser address bar
PAT performs one write The Issue comment author is the account that owns the token Gitee Issue comment area
Webhook test Returns 200 and the event appears on the Events page Gitee WebHook details and the Grape Events page

GitCode integration | GitHub integration | Account activation and login