【问题标题】:Will the Google+ OAuth shutdown affect me, if my code has no visible reference to Google+?如果我的代码没有对 Google+ 的可见引用,Google+ OAuth 关闭会影响我吗?
【发布时间】:2019-02-03 02:48:48
【问题描述】:

我收到了一封来自 Google 的电子邮件,警告我我的 Google App Script 项目将受到即将关闭的(2019 年 1 月 28 日至 2019 年 3 月 7 日)Google+ API 关闭的影响。

您好 Google+ 开发者,

以下电子邮件包含您最近对 Google+ API 的使用情况。注意:它包括 Google+ OAuth 范围请求,这些请求也会受到 Google+ 关闭的影响。之前发送给活动 API 调用者的电子邮件未包含有关 OAuth 请求的信息。最后一封提醒电子邮件将在 2 月份发送给仍有活跃 API 或 OAuth 请求活动的用户。

我需要知道什么? 2019 年 3 月 7 日,所有 Google+ API 和 Google+ 登录将完全关闭。这将是逐步关闭,API 调用最早在 2019 年 1 月 28 日开始间歇性失败,而对 Google+ 范围的 OAuth 请求最早在 2019 年 2 月 15 日开始间歇性失败。

我需要做什么? 请在 2019 年 3 月 7 日之前更新您的下列项目,并确保它们不再使用 Google+ API 或请求 Google+ OAuth 范围。下面的数据显示了您的项目最近调用了哪些 Google+ API 方法,以及它请求的 Google+ OAuth 范围。 注意:如果您看到对 people.get 的调用,这可能是在您的应用程序中使用 Google+ 登录功能的结果,该功能现已完全弃用并正在关闭。开发者应该从 Google+ 登录功能迁移到更全面的 Google 登录身份验证系统。

这封电子邮件明确说明了我的项目中的故障,并提供了以下位置详细信息:

Project...............:My_GAS_Project_Name  
Google+ API Name......:OAuth    
Version...............:N/A
Method or OAuth Scope.:plus.me

但我认为这是误报。

我使用的是 OAuth API,而不是 Google+ API。我搜索了以下字符串; “加号”和“+”在我的代码中,并没有在任何地方找到引用*。

*是的,到处都有“+”,但每个人都被视为字符串连接操作。

这是项目中的OAuth功能:

function _getAuthenticationToken_() {
  // Check we have access to the service
  var service = getService();
  if (!service.hasAccess()) {
    var authorizationUrl = service.getAuthorizationUrl();
    _log_('INFO', 'Open the following URL and re-run the script: ' + authorizationUrl);
    return;
  }

  Logger.log('Passed Authentication');

  //Get the Access Token
  return service.getAccessToken();

  function getService() {
    // Create a new service with the given name. The name will be used when
    // persisting the authorized token, so ensure it is unique within the
    // scope of the property store.
    return OAuth2.createService('jlr-edw-dev-service')

    // Set the endpoint URLs, which are the same for all Google services.
    .setAuthorizationBaseUrl('https://accounts.google.com/o/oauth2/auth')
    .setTokenUrl('https://accounts.google.com/o/oauth2/token')

    // Set the client ID and secret, from the Google Developers Console.
    .setClientId(CLIENT_ID)
    .setClientSecret(CLIENT_SECRET)

    // Set the name of the callback function in the script referenced
    // above that should be invoked to complete the OAuth flow.
    .setCallbackFunction('authCallback')

    // Set the property store where authorized tokens should be persisted.
    .setPropertyStore(PropertiesService.getUserProperties())

    // Set the scopes to request (space-separated for Google services).
    // this is admin access for the sqlservice and access to the cloud-platform:
    .setScope(
      'https://www.googleapis.com/auth/sqlservice.admin ' + 
      'https://www.googleapis.com/auth/cloud-platform')

    //Removed because this Should be covered by cloud-platform
    //'https://www.googleapis.com/auth/devstorage.read_write ' 

    // Below are Google-specific OAuth2 parameters.

    // Sets the login hint, which will prevent the account chooser screen
    // from being shown to users logged in with multiple accounts.
    .setParam('login_hint', Session.getActiveUser().getEmail())

    // Requests offline access.
    .setParam('access_type', 'offline')

    // Forces the approval prompt every time. This is useful for testing,
    // but not desirable in a production application.
    .setParam('approval_prompt', 'force');
  }

  function authCallback(request) {
    var cloudSQLService = getService();
    var isAuthorized = cloudSQLService.handleCallback(request);

    if (isAuthorized) {
      _log_('INFO', 'Access Approved');
      return HtmlService.createHtmlOutput('Success! You can close this tab.');
    } else {
      _log_('INFO', 'Access Denied');
      return HtmlService.createHtmlOutput('Denied. You can close this tab');
    }
  }
}

我应该忽略来自 Google 的警告,还是我可以检查其他任何东西来确认这些项目没有风险?

我应该补充一点,这些项目是通过 Google App Script Execution API 公开的,并且它们的功能是通过 Java program based on the the Google example 执行的。只有以这种方式访问​​的项目才被标记。

更多细节添加以回应 DaImTo 的评论。

项目资源中启用的唯一库是 OAuth:

Google+ API 和 People API 均已关闭:

该项目的 API 仪表板也不包含 Google+:

更新

我想我可能知道现在发生了什么。下图说明了这些组件。

1) 这些是从用于执行 Google 应用脚本的 Java 程序中提取的范围。它们包括范围“https://www.googleapis.com/auth/userinfo.email”。

2) 这是Google OAuth2 API, v2 范围文档。

3) 这些是授予 Google App Script 项目的范围。根据描述性名称,“plus.me”似乎已包含在内,即“知道您在 Google 上的身份 = https://www.googleapis.com/auth/plus.me”。

因此,由于某种原因,在请求访问“https://www.googleapis.com/auth/userinfo.email”时,请求被扩展为包括“https://www.googleapis.com/auth/plus.me”。我认为这可能是因为“serinfo.email”已被弃用,described here

已解决

来自 Google 的进一步沟通表明这确实是误报,不需要更改代码。

尊敬的开发者,

本周早些时候,我们向您发送了一封与您的项目相关的电子邮件,这些项目将受到 Google+ API 关闭的影响,这也会影响对 Google+ OAuth 范围的请求。

电子邮件列出了您的一个或多个项目正在请求“plus.me”范围,因此会受到影响。我们想澄清的是,只有直接请求“plus.me”范围的项目才会受到影响。即使您的项目没有直接要求,此范围可能已在某些电子邮件中列出。对于造成的任何混乱,我们深表歉意。

如果您直接请求“plus.me”范围、任何其他 Google+ OAuth 范围或进行任何 Google+ API 调用,请确保在 2019 年 3 月 7 日之前从您的项目中删除这些请求。

查看您的项目是否直接请求“plus.me”或任何其他 Google+ OAuth 范围:

• 如果您的项目是用 Google Apps 脚本编写的,您可以通过在应用脚本编辑器中查看您的项目属性来查看您的项目请求的范围。

• 如果您的项目不是用 Google Apps 脚本编写的,请检查您的代码以获取 OAuth 范围请求中对“plus.me”的引用。我们建议您使用任何支持登录或社交功能的第三方库来审核项目,因为这些库也可能会受到关闭的影响。

感谢您成为重要的 Google+ 开发者。

真诚地, Google+ API 团队

【问题讨论】:

    标签: google-apps-script oauth-2.0 google-api google-plus google-oauth


    【解决方案1】:

    我认为您应该在 Google 开发者控制台中查看。确保您尚未在项目中启用 google+ api。这可能导致了误报。

    这是我唯一能想到的。即使这是一个代码问题,谷歌实际上也无法访问开发人员的代码,他们也不会扫描每个脚本来发出警告。

    【讨论】:

    • 谢谢。没有明确启用 Google+ 或 People API(上面的屏幕截图)。我不希望代码被扫描,但在代码中包含引用会导致库自动添加到后台配置信息中,例如应用脚本.json。所以我想向人们保证,我没有以这种方式引起引用。
    • 我认为谷歌有比扫描人的代码更好的事情要做。但我可以 ping 团队,看看我们是否能找出你收到电子邮件的原因。
    猜你喜欢
    • 1970-01-01
    • 2021-03-07
    • 1970-01-01
    • 2013-02-17
    • 2020-03-25
    • 1970-01-01
    • 2017-11-03
    • 1970-01-01
    • 2020-03-13
    相关资源
    最近更新 更多