OAuth provider connections aren't persisted per user-repository driver — falls back to a local file even when statamic.users.repository is eloquent
维护者通常 1 天内回复
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
调研方向
Start with src/OAuth/Provider.php to understand how getIds() and setIds() currently persist provider mappings, then trace how OAuth\Manager builds providers and how the Eloquent user repository is selected. The issue proposes Eloquent-backed connections when that repository is active; check linked pull request #15070 for work already in progress. Done means OAuth connections persist through the configured Eloquent repository rather than relying on a local file.
由索引模型根据 Issue 内容生成。
描述
Description
Statamic\OAuth\Provider persists the mapping between a provider account (e.g. a Google sub) and a Statamic user via getIds()/setIds(), which read/write a plain PHP file at storage_path("statamic/oauth/{$this->name}.php") (src/OAuth/Provider.php). This happens unconditionally — regardless of which user repository driver is configured.
That's a reasonable default for the flat-file user repository, where there's no database to lean on. But when config('statamic.users.repository') is eloquent, users/roles/groups already live in the database via Statamic\Auth\Eloquent\User/UserRepository. OAuth connections are the one piece of auth-related state still stuck on local disk in that setup.
In practice, storage_path() isn't durable in a lot of environments an Eloquent-driven app would run in — ephemeral compute, multiple app instances behind a load balancer, deploy pipelines that don't preserve arbitrary storage/ subpaths across releases. When that file is missing or not visible to the instance handling a request, findUser() returns null, handleProviderCallback() falls through to createUser(), discovers the email already taken, throws OAuthEmailExistsException, and the user is silently redirected to the unauthorized page — no exception logged, no visible error.
Suggested fix
Extend the existing driver-aware pattern (already used for users/roles/groups) to OAuth connections: when the eloquent repository is active, OAuth\Manager builds providers backed by an Eloquent-persisted connections table instead of the file.
We've built and tested this as a PR — happy to have it adjusted to fit core's preferred conventions.
Version
statamic/cms v6.26.0 (reproduced against latest 6.x as of this report too)
- 主要语言
- PHP
- 星标
- 4.9k
- 派生
- 647
- 平均合并
- 1 天 45 分钟
- 30 天内合并 PR
- 221
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
statamic/cms 的其他 Issue
-
forms ui
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
accessibility
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
antlers
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
Nav: link to the site root with an anchor (/#section) gets is_parent on every page可能已有人在做 @duncanmcclean 今天认领。 未关闭navigations
难度 2/5 1-3 小时 新手友好度 35/100
维护者通常 1 天内回复
-
Multiple Choice and Checkboxes no longer offer "Inline", but the default views still use it可能已有人在做 @duncanmcclean 今天认领。 未关闭forms
难度 4/5 3-5 天 新手友好度 35/100
维护者通常 1 天内回复
相似的 Issue
-
sync-en
难度 1/5 1 小时以内 新手友好度 86/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 83/100
taskforcesh/bullmq#5238 ·
维护者通常 1 天内回复
-
[Bug] v-change-database-password reports success but doesn't change the password when MySQL validate_password rejects it可能已有人在做 @bfs2021 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
Automattic/jetpack#55517 ·
维护者通常 1 天内回复