Google OAUth 同意屏幕未显示本地开发中的敏感或受限范围

问题描述 投票:0回答:1

我正在本地开发,测试 Google 的 OAUth。我能够进行身份验证,但由于某种原因,Google 没有向我显示同意敏感和受限范围的屏幕(例如

https://mail.google.com/
)。我几小时前确实在 Google Console 中添加了这些范围 - 为什么它们没有显示?

我得到的只是这个屏幕:

我的应用程序处于“测试”模式,未经验证。

我已经阅读了 Stackoverflow 上有关 OAuth 屏幕的许多问题,但没有成功。

我认为这并不重要,但我正在使用 Supabase 来启动 OAuth 流程。我的理解是,范围完全由 Google 端管理,因此我并不怀疑 Supabase 或我的代码是根本原因:

const { data, error } = await supabase.auth.signInWithOAuth({
  provider: "google",
  options: {
    redirectTo: "http://localhost:3000/callback", //after the google redirect, we need to redirect to this route
    queryParams: {
      access_type: "offline",
      prompt: "consent",
    },
  },
google-api google-oauth
1个回答
0
投票

事实证明您必须实际请求范围。 Google 控制台设置只是允许您请求它。

      provider: "google",
      options: {
        redirectTo: "http://localhost:3000/callback", //after the google redirect, we need to redirect to this route
        queryParams: {
          access_type: "offline",
          prompt: "consent",
          scope: "https://www.googleapis.com/auth/gmail.readonly", //add scopes here
        },
      },
    });
© www.soinside.com 2019 - 2024. All rights reserved.