docs: clarify GitHub OAuth email setup

docs: clarify github oauth email setup
This commit is contained in:
Dream Hunter
2026-04-29 02:04:11 +08:00
committed by GitHub
parent 4e01b4e26f
commit c703082391
6 changed files with 26 additions and 2 deletions

View File

@@ -17,6 +17,7 @@
- docs: |文档| 在 `quick-start` / `worker-vars` / `email-routing` 三个入口文档(中英文)显式补充"域名是部署前提条件"提示,强调需先在 Cloudflare 启用 Email Routing 并下发邮件 DNS 记录、Worker 部署后再绑定 Catch-all子域名需单独启用避免用户在没有可用域名时直接开始部署却收不到邮件issue #1004
- docs: |部署排障| 优化近期 issue 暴露的 UI 部署与升级排障文档:补充 `nodejs_compat`、D1 绑定名必须为 `DB``/open_api/settings` 校验、后端 API 地址填写、Cloudflare 安全挑战导致 `Network Error`、D1 容量上限与 Cron Trigger 自动清理、GitHub OAuth 公开邮箱、admin 管理口令与用户账号区别、随机二级域名 API 需传 `enableRandomSubdomain` 等说明;同时将帮助/FAQ 菜单移动到核心配置之后,提升可见性
- docs: |文档| 补充重新创建旧邮箱提示地址已存在时的处理方式,并完善 GitHub Actions 自动更新配合 Page Functions 转发后端请求的 workflow 说明issues #947 #654
- docs: |OAuth2| 补充 GitHub 私密邮箱登录配置,说明可使用 `https://api.github.com/user/emails`、JSONPath 邮箱字段和 `user:email` scope 获取主邮箱issue #655
### Bug Fixes

View File

@@ -17,6 +17,7 @@
- docs: |Docs| Make "a domain is a hard prerequisite" explicit at the top of `quick-start`, `worker-vars`, and `email-routing` (zh + en), spelling out that Cloudflare Email Routing must be enabled with email DNS records provisioned before deployment, the Catch-all rule must be bound after the Worker is deployed, and subdomains do not inherit the parent domain's Email Routing — so users no longer start deploying without a usable domain and end up unable to receive mail (issue #1004)
- docs: |Deployment troubleshooting| Improve docs for recent UI-deployment and upgrade issues: document `nodejs_compat`, the required uppercase `DB` D1 binding, `/open_api/settings` verification, backend API URL entry, Cloudflare security challenges causing `Network Error`, D1 size limits and Cron Trigger cleanup, GitHub OAuth public email requirements, the difference between admin passwords and user accounts, and the `enableRandomSubdomain` API flag; move the Help/FAQ menu directly after Core Configuration so it is easier to find
- docs: |Docs| Document how to handle the "address already exists" case when recreating an old mailbox, and clarify the GitHub Actions workflow for automatic updates with Page Functions forwarding backend requests (issues #947 #654)
- docs: |OAuth2| Document GitHub private-email login configuration using `https://api.github.com/user/emails`, a JSONPath email field, and the `user:email` scope to read the primary email (issue #655)
### Bug Fixes

View File

@@ -20,7 +20,7 @@
| `No such module "node:stream". imported from "worker.js"` | [Reference](/en/guide/ui/worker) |
| `Subdomain cannot send emails` | [Reference](https://github.com/dreamhunter2333/cloudflare_temp_email/issues/515) |
| `Failed to send verify code: No balance` | Set unlimited emails in admin console or increase quota on the sending permission page |
| `GitHub OAuth unable to get email` / `[400]: Failed to get user email from OAuth2 provider` | The GitHub template reads the `email` field from `https://api.github.com/user`. If the GitHub account hides its public email, this field is `null`. Make the email public in the GitHub profile, or use an OAuth2 provider/API that returns an email field |
| `GitHub OAuth unable to get email` / `[400]: Failed to get user email from OAuth2 provider` | The GitHub template reads the `email` field from `https://api.github.com/user`. If the GitHub account hides its public email, this field is `null`. Select a `Public email` in the GitHub profile, or change `User Info URL` to `https://api.github.com/user/emails`, `User Email Key` to `$[?(@.primary==true)].email`, and `Scope` to `user:email` |
| `Cannot read properties of undefined (reading 'map')` during page initialization | First check whether `/open_api/settings` is returning valid data. In a direct Worker deployment, this usually means Worker variables were not configured correctly, so verify JSON-format variables such as `DOMAINS` and `ADMIN_PASSWORDS`. If this happens in a Pages deployment because requests are going to the wrong backend address, continue with the Pages troubleshooting section below |
| Worker backend opens as `OK`, but every frontend request shows `Network Error` | First open the frontend in an incognito window to rule out a cached old frontend bundle. Then make sure Cloudflare security modes such as Under Attack, Bot Fight, or Managed Challenge are not applied to the API domain; those browser challenges block XHR/API requests and surface as `Network Error` |
| Mail suddenly stops arriving, deleting a few mails makes it work again, and Worker logs show `D1_ERROR: Exceeded maximum DB size` | The D1 database has reached its per-database size limit and can no longer write `raw_mails`. Delete old mails, enable auto cleanup in the admin console, and make sure the Worker has a `Settings -> Trigger Events -> Cron Triggers` schedule; otherwise admin cleanup settings will not run automatically |

View File

@@ -17,6 +17,18 @@
an email field. If the returned value is not a standard email, use the "Email Format
Transformation" section below.
If you do not want to expose a public GitHub email, use the GitHub email list API instead:
| Field | Value |
|-------|-------|
| User Info URL | `https://api.github.com/user/emails` |
| User Email Key | `$[?(@.primary==true)].email` |
| Scope | `user:email` |
When a `Public email` is selected in the GitHub profile, the default `https://api.github.com/user`
endpoint with `User Email Key = email` can still be used. Merely changing an email from private to
visible without selecting it as the public email can still make the `/user` API return `email: null`.
Reference: [Creating an OAuth App](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/creating-an-oauth-app)
### Linux Do

View File

@@ -20,7 +20,7 @@
| `No such module "node:stream". imported from "worker.js"` | [参考](/zh/guide/ui/worker) |
| `二级域名无法发送邮件` | [参考](https://github.com/dreamhunter2333/cloudflare_temp_email/issues/515) |
| `Failed to send verify code: No balance` | admin 后台设置无限制邮件或者发件权限页面增加额度 |
| `GitHub OAuth 无法获取到邮箱` / `[400]: 从 Oauth2 提供商获取用户邮箱失败` | GitHub 模板会从 `https://api.github.com/user``email` 字段读取邮箱。GitHub 账号如果隐藏公开邮箱,该字段会是 `null`,需要在 GitHub 个人资料中设置公开邮箱,或改用会返回邮箱字段的 OAuth2 提供商/接口 |
| `GitHub OAuth 无法获取到邮箱` / `[400]: 从 Oauth2 提供商获取用户邮箱失败` | GitHub 模板会从 `https://api.github.com/user``email` 字段读取邮箱。GitHub 账号如果隐藏公开邮箱,该字段会是 `null`。可以在 GitHub 个人资料中选择 `Public email`,或把 `User Info URL` 改为 `https://api.github.com/user/emails``User Email Key` 改为 `$[?(@.primary==true)].email``Scope` 改为 `user:email` |
| 页面初始化时报 `Cannot read properties of undefined (reading 'map')` | 先看 `/open_api/settings` 返回是否正常。如果是 Worker 直连部署,通常是 worker 变量没有设置成功,请检查 `DOMAINS``ADMIN_PASSWORDS` 等 JSON 格式变量是否正确配置;如果是 Pages 前端部署并且请求打到了错误地址,则继续看下方 Pages 相关排障 |
| 后端 Worker 页面打开是 `OK`,但前端所有请求都是 `Network Error` | 先在浏览器无痕模式打开前端,排除旧前端包缓存。再确认 Cloudflare 没有对 API 域名开启 Under Attack、Bot Fight、Managed Challenge 等需要浏览器挑战的安全策略;这些挑战会拦截 XHR/API 请求并表现为 `Network Error` |
| 邮件突然收不到删除几封邮件后恢复Worker 日志出现 `D1_ERROR: Exceeded maximum DB size` | D1 单数据库达到容量上限后无法继续写入 `raw_mails`。请清理旧邮件、开启 admin 后台自动清理,并确认 Worker 的 `Settings -> Trigger Events -> Cron Triggers` 已添加定时触发器,否则后台清理配置不会自动执行 |

View File

@@ -13,6 +13,16 @@
- 默认 GitHub 模板使用 `https://api.github.com/user` 作为用户信息接口,并读取返回 JSON 的 `email` 字段。GitHub 账号如果隐藏公开邮箱,该字段会是 `null`,登录会返回 `[400]: 从 Oauth2 提供商获取用户邮箱失败`
- 解决方式是在 GitHub 个人资料中设置公开邮箱,或改成能返回邮箱的接口/提供商;如果返回值不是标准邮箱,可以使用下方“邮箱格式转换”。
如果不想公开 GitHub 邮箱,可以改用 GitHub 邮箱列表接口:
| 字段 | 值 |
|------|----|
| User Info URL | `https://api.github.com/user/emails` |
| User Email Key | `$[?(@.primary==true)].email` |
| Scope | `user:email` |
GitHub 个人资料中选择了 `Public email` 时,可以继续使用默认的 `https://api.github.com/user` + `email` 配置;只把邮箱从 private 改成可见但没有选择公开邮箱时,`/user` 接口仍可能返回 `email: null`
参考 [Creating an OAuth App](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/creating-an-oauth-app)
### Linux Do