20 lines
1.2 KiB
Markdown
20 lines
1.2 KiB
Markdown
# OAuth 2.0 第三方登录:分提供商教程(Golang)
|
||
|
||
本目录为**通用**接入说明,适用于任意自建后端或 BFF:在对应**身份提供商(IdP)**注册应用,使用 **OAuth 2.0 授权码(Authorization Code)** 换 `access_token`,再调用各平台用户 API。语言示例统一为 **Go**(`golang.org/x/oauth2`)。
|
||
|
||
| 文档 | 说明 |
|
||
|------|------|
|
||
| [github.md](github.md) | GitHub OAuth App,标准 `github.Endpoint` |
|
||
| [gitea.md](gitea.md) | 自建/托管 Gitea 的 OAuth2,端点随实例 URL 变化 |
|
||
| [linuxdo.md](linuxdo.md) | LINUX DO Connect(官方 Connect 端点) |
|
||
| [google.md](google.md) | Google 账号,官方 `google.Endpoint` + userinfo |
|
||
| [microsoft.md](microsoft.md) | Microsoft / Entra ID,v2.0 终结点 + Microsoft Graph |
|
||
|
||
**共同前提**
|
||
|
||
- 浏览器中完成授权;`redirect_uri` 必须在 IdP 控制台**逐字登记**(含 `http`/`https`、主机、端口、路径)。
|
||
- 换 token 与调用户 API 一般由**你的服务端**发起;请保证服务器出网可达对应域名(企业网络/地区网络可能需代理)。
|
||
- 生产环境使用 **HTTPS**;`state` 参数防 CSRF,勿省略。
|
||
|
||
以下各篇相互独立,可按需只读其一。
|