Google Oauth2.0 未发布测试应用程序接受不在测试用户列表中的用户

Google Oauth2.0 Unpublished Test App accepts users not in test user list

我在我的 Next.js/Node.js 网络应用程序中使用 google Ouath2.0 和 passport.js。注册和登录按预期工作。但是,任何拥有 google 帐户的人都可以注册,无论是否在测试用户列表中。该应用程序未发布,因此只有我在 Oauth 同意屏幕上注册的测试用户才能注册和登录。

有谁知道如何解决这个问题?据我了解,未注册为测试用户时登录应该会失败。我在其他地方看到这个问题没有答案,我无法联系 google 因为这需要付费支持级别。

我快速浏览了一下并观察到相同的(不正确的)行为;我也无法将经过身份验证的用户限制在测试用户列表中:

  1. 已创建 Apps Script Web 应用程序(快速获胜)
  2. 已将云平台项目与其相关联
  3. 在项目中启用了 Gmail API 并添加了其中一个“受限”scopes
  4. 添加了一个 Google 帐户来测试用户

无论是否包含 Gmail 限制范围,我都能够使用测试用户和任何其他 Gmail 帐户登录。

One thing I observed but am unable to explain is that I was not presented with the app's (project's) OAuth Consent Screen. Each time I logged in (incognito), I was prompted by the standard Google login screen only. I expected to be prompted by the OAuth Consent Screen before accessing the app. This likely explains why identities aren't being limited to the test users but I'm unsure why I'm not seeing the consent screen.

即使没有 Google 付费支持,您也可以使用 Google 的 public 问题跟踪器提交此类问题,Google 工程师会看到这些问题。

我建议您在“云平台 > 安全和身份”下提交文件,让 Google 中的某人进行分类:

https://issuetracker.google.com/issues/new?component=187167&template=1162765