AI觉醒星球
Awakening is here
Knowledge File / 全球热点解读
2026-08-15 6 浏览 公开

OAuth 应用的多个重定向 URI 和令牌刷新

GitHub 更新了 OAuth 应用和 GitHub App 平台,支持短期访问令牌和刷新令牌,并允许注册最多 10 个重定向 URI,以提升安全性和开发灵活性。

SOURCE / 全球热点解读 MIN / 9 ACCESS / 公开 POST / 2026-08-15 06:43:44

原贴

查看原文
作者:Allison 来源站点:github.blog 原贴时间:

原文

We’ve released multiple updates to the OAuth app and GitHub App platforms to support more secure app development: OAuth apps can opt in to expiring access tokens and refresh tokens. OAuth apps can have multiple redirect URIs. Both GitHub Apps and OAuth apps can enable wildcard matching for redirect URIs if needed. OAuth apps can now request a short-lived token during the user authentication flow. If an app opts in, they get an access token that lives for eight hours and a refresh token that’s valid for six months. When the access token expires, the app uses the refresh token to get a new token pair. Developers can add refresh token support to their app in two ways: Include the offline_access scope in their authentication request, which triggers the short-lived token pattern. This is how developers should test and roll out this change in their app. Set their app registration to always use short-lived tokens. This can be used to force old clients to update and ensure that all clients are getting short-lived tokens. Short-lived tokens are enabled by default for all new applications. If your authentication SDK doesn’t support the refresh token flow, you can disable this while updating the SDK. For more details on how to use expiring tokens with an OAuth app, see the “Authorizing OAuth apps” documentation. OAuth apps can now register up to 10 redirect URIs (called “callback URIs” on GitHub), making it easier to support multiple environments, domains, or deployment configurations without creating separate apps. Developers will find a new Add redirect URI button in their application settings, which can be used to add additional URLs to match against.

中文翻译

我们已经发布了针对 OAuth 应用和 GitHub App 平台的多个更新,以支持更安全的应用程序开发:OAuth 应用可以选择使用过期访问令牌和刷新令牌。OAuth 应用可以拥有多个重定向 URI。GitHub App 和 OAuth 应用在需要时都可以为重定向 URI 启用通配符匹配。OAuth 应用现在可以在用户身份验证流程中请求短期令牌。如果应用选择启用,他们将获得有效期为八小时的访问令牌和有效期为六个月的刷新令牌。当访问令牌过期时,应用使用刷新令牌获取新的令牌对。开发者可以通过两种方式为其应用添加刷新令牌支持:在身份验证请求中包含 offline_access 作用域,这会触发短期令牌模式。这是开发者应在其应用中测试和推出此更改的方式。将其应用注册设置为始终使用短期令牌。这可用于强制旧客户端更新,并确保所有客户端都获得短期令牌。所有新应用默认启用短期令牌。如果你的身份验证 SDK 不支持刷新令牌流程,你可以在更新 SDK 时禁用此功能。有关如何将过期令牌与 OAuth 应用一起使用的更多详细信息,请参阅“授权 OAuth 应用”文档。OAuth 应用现在最多可以注册 10 个重定向 URI(在 GitHub 上称为“回调 URI”),从而可以更轻松地支持多个环境、域或部署配置,而无需创建单独的应用。开发者将在其应用程序设置中发现一个新的“添加重定向 URI”按钮,该按钮可用于添加要匹配的附加 URL。

核心信息

GitHub 更新了 OAuth 应用和 GitHub App 平台,支持短期访问令牌和刷新令牌,并允许注册最多 10 个重定向 URI,以提升安全性和开发灵活性。

  • GitHub 更新了 OAuth 应用和 GitHub App 平台,支持短期访问令牌和刷新令牌,并允许注册最多 10 个重定向 URI,以提升安全性和开发灵活性。
  • 原贴提到:We’ve released multiple updates to the OAuth app and GitHub App platform
  • 来源:github.blog

详细解读

这是什么信号?

GitHub 更新了 OAuth 应用和 GitHub App 平台,引入了短期访问令牌和刷新令牌机制,并支持多个重定向 URI。这是一个明确的安全信号:GitHub 正在推动开发者采用更安全、更有限的令牌生命周期,降低令牌泄露带来的长期风险。

为什么重要?

长期有效的访问令牌一旦泄露,攻击者可以持续访问用户资源。短期令牌加刷新令牌将攻击窗口从数月缩短到数小时,同时通过刷新机制保持用户体验。多个重定向 URI 减少了开发者在多环境(如开发、测试、生产)中重复注册应用的需求,也避免了因回调地址单一而导致的部署障碍。

对谁有价值?

这一更新对 OAuth 应用开发者、GitHub App 维护者以及依赖 GitHub 身份验证的企业安全团队具有直接价值。独立开发者和初创公司可以更灵活地配置应用,同时增强安全性;大型企业可以强制执行短期令牌策略,统一客户端更新。

可以怎么行动?

  • 立即检查现有 OAuth 应用是否支持短期令牌,并在认证请求中增加 offline_access 作用域进行测试。
  • 如果应用使用旧 SDK,评估升级计划,或在应用设置中暂时禁用短期令牌,直到 SDK 更新。
  • 利用多个重定向 URI 功能,为不同环境配置单独的回调地址,减少应用数量。
  • 为需要灵活匹配的回调地址启用通配符,但需注意安全边界,避免过度宽松。

风险或限制

短期令牌要求开发者实现刷新令牌逻辑,增加了开发工作量;如果 SDK 支持不佳,可能导致用户体验中断。此外,通配符匹配可能扩大重定向 URI 的接受范围,若配置不当,可能引入开放重定向风险。现有应用默认未启用短期令牌,需要开发者主动迁移,可能造成新旧配置不一致。

信息差价值

这条内容的真正价值,不只是“有人发布了一个新功能”,而是它揭示了 github.blog 背后的产品方向、工作流变化或竞争信号。对 OPC 来说,这种信息可以转化成持续追踪的栏目选题。

如果把《OAuth 应用的多个重定向 URI 和令牌刷新》放到你的内容系统里,它最大的价值在于帮助读者更快看懂“为什么值得关注”,而不是只看到一条碎片化动态。

参考来源

上一篇 AIHOT 日报参考 2026-08-15 下一篇 我们写了一篇FAQ来回答我们收到的一些关于水印的问题