同意屏幕仅要求电子邮件 SSO - 而非 Google 日历权限

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

无论我做什么,我似乎都无法获得显示 Google 日历权限的同意屏幕。

同意屏幕

我处于测试模式并且正在使用测试用户。尽管如此,我似乎还是无法弄清楚这一点。有谁知道为什么吗?

async function handleSignInWithGoogle(response) {
  const nonce = await generateNonce();
  const { data, error } = await supabase.auth.signInWithIdToken({
    provider: 'google',
    token: response.credential,
    nonce: nonce,
    options: {
      scopes: ['openid', 'profile', 'email', 'https://www.googleapis.com/auth/calendar.readonly']
    }
  });
  if (error) {
    console.error('Error signing in:', error.message);
  } else {
    email = data.user?.email ?? '';
    accessToken = data.session?.access_token;
    console.log('Access Token:', accessToken);
  }
  loading = false;
}
const handleGoogleLogin = async () => {
  loading = true;

  const { data, error } = await supabase.auth.signInWithOAuth({
    provider: 'google',
    options: {
      scopes: ['openid', 'profile', 'email', 'https://www.googleapis.com/auth/calendar.readonly']
    }
  });

  if (error) {
    console.error('Error signing in:', error.message);
  } else {
    email = data.user.email;
  }

  loading is false;
};
google-oauth google-calendar-api
1个回答
0
投票

首先,您没有使用 Google oauth 库,您似乎正在使用名为 supabase 的第三方库,该库似乎正在登录 google。

登录即是身份验证。这不是授权。对于 Google 日历,您需要使用授权 oauth2

© www.soinside.com 2019 - 2024. All rights reserved.