Skip to content

Commit

Permalink
增加Gitee OAuth 接入方式文档内容 (#133)
Browse files Browse the repository at this point in the history
* Update q14.md

* update

---------

Co-authored-by: uubulb <uub@kuzu.uk>
  • Loading branch information
muzihuaner and uubulb authored Jan 1, 2025
1 parent 14564f1 commit 81522de
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 1 deletion.
35 changes: 34 additions & 1 deletion docs/en_US/guide/q14.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Configuration explanation:

Before using this feature, you need to create an OAuth 2.0 application on the third-party website.

The Callback URI of Nezha is: `https://nezha.example.com/api/v1/oauth2/callback`
The Callback URI of Nezha is: `/api/v1/oauth2/callback`

Since the steps vary across different websites, only some examples can be provided here. Generally speaking, the operations on each platform are similar, and you only need to obtain the information needed by Nezha.

Expand Down Expand Up @@ -171,6 +171,39 @@ oauth2:

</details>

#### Gitee

<details>
<summary>Expand/Collapse</summary>

1. Go to `https://gitee.com/oauth/applications`, click on the `Create Application` button on the right to create a new OAuth 2.0 application, and fill in the following details:

- `Application Name`: Your application name, for example, `ServerStatus`;
- `Upload LOGO`: Your application icon;
- `Homepage URL`: Your Nezha address, for example, `https://nezha.example.com`;
- `Callback URL`: Nezha Callback URL, for example, `https://nezha.example.com/api/v1/oauth2/callback`;
- `Scope`: Only `user_info` is needed here.
The rest can be left as default.

2. After creation, you will be redirected to the My Applications page. Click on `Application Details` to save the Client ID and Client Secret.
3. Fill in the Nezha OAuth 2.0 configuration, save it, and restart Dashboard:

```yaml
oauth2:
Gitee:
clientid: "a-unique-id"
clientsecret: "a-unique-secret"
endpoint:
authurl: "https://gitee.com/oauth/authorize"
tokenurl: "https://gitee.com/oauth/token"
scopes:
- user_info
userinfourl: "https://gitee.com/api/v5/user"
useridpath: "id"
```

</details>

---

## Binding Accounts
Expand Down
34 changes: 34 additions & 0 deletions docs/guide/q14.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,40 @@ oauth2:

</details>

#### Gitee

<details>
<summary>点击展开/收起</summary>


1. 进入 `https://gitee.com/oauth/applications`,点右侧 `创建应用` 创建新的 OAuth 2.0 应用,填写以下内容:

- `应用名称`:你的应用名称,例如 `ServerStatus`;
- `上传LOGO`:你的应用图标;
- `应用主页`:你的哪吒面板地址,例如 `https://nezha.example.com`;
- `回调地址`:哪吒 Callback URL,比如 `https://nezha.example.com/api/v1/oauth2/callback`;
- `权限`:这里只需要 `user_info`。
其它的默认即可

2. 创建之后会跳转到我的应用界面,点击 `应用详情` 保存下 Client ID 和 Client Secret;
3. 填写哪吒 OAuth 2.0 配置,保存后重启面板:

```yaml
oauth2:
Gitee:
clientid: "a-unique-id"
clientsecret: "a-unique-secret"
endpoint:
authurl: "https://gitee.com/oauth/authorize"
tokenurl: "https://gitee.com/oauth/token"
scopes:
- user_info
userinfourl: "https://gitee.com/api/v5/user"
useridpath: "id"
```

</details>

---

## 绑定账户
Expand Down

0 comments on commit 81522de

Please sign in to comment.