进入配置文件目录:
cd /opt/nezha/dashboard/data
使用 nano 编辑器打开配置文件:
sudo nano config.yaml
打开 https://github.com/settings/developers,依次选择 “OAuth Apps” - “New OAuth App”。
填写以下需要的字段:
Application name:应用名
Homepage URL:面板访问地址,例如 https://nezha.example.com
Authorization callback URL 面板的 Callback 地址,这里只检测前缀,所以可以填写 https://nezha.example.com/api/v1/oauth2/callback。
在新页面中保存 Client ID 和 Client secrets,完成面板 OAuth 2.0 配置:
oauth2:
GitHub:
client_id: "a-unique-id"
client_secret: "a-unique-secret"
endpoint:
auth_url: "https://github.com/login/oauth/authorize"
token_url: "https://github.com/login/oauth/access_token"
user_info_url: "https://api.github.com/user"
user_id_path: "id"
只需要更改client_id: "a-unique-id"和client_secret: "a-unique-secret",其他的不要动。
按 Ctrl + O → 按 Enter 保存文件
按 Ctrl + X 退出编辑器
重启哪吒探针!
然后去哪吒探针后台个人信息绑定Github,关闭密码登录即可。