跳转到主要内容
oauthApplications 保存 web 所知道的 OAuth 客户端。一个文档对应一个客户端。在 Ayakaleaf Pro 中,唯一写入它的是 web 模块 git-bridge:web 启动时,它会创建一个名为 Overleaf Git Bridge 的客户端。Schema 位于 services/web/app/src/models/OauthApplication.mjs。

字段

写入方

读取方

索引

只有默认的 _id 索引。唯一索引 id_1 仅来自标记为 saas(20190912145016_create_oauthApplications_indexes.mjs)和 server-pro(20230502180757_server_pro_oauth_indexes.mjs)的迁移,而 Community Edition 不运行这些迁移。

说明

  • Web 只用 @node-oauth/oauth2-server 校验 bearer 令牌(services/web/app/src/Features/Authentication/AuthenticationController.mjs:409-450 中的 server.authenticate),这只会调用模型的 getAccessToken 和 verifyScope。没有路由提供 /oauth/token 或 /oauth/authorize,因此 getClient、saveToken 和 saveAuthorizationCode 从不会被调用。
  • 该模块先按名称查找客户端再创建它,而 Community Edition 在 name 和 id 上都没有唯一索引,所以没有任何机制阻止出现第二个同名客户端。需要该客户端的代码会使用 findOne 返回的那一个。
最后修改于 2026年11月20日