<?php

final class PhabricatorAuthProviderOAuthGoogle
  extends PhabricatorAuthProviderOAuth {

  public function getProviderName() {
    return pht('Google');
  }

  public function getConfigurationHelp() {
    $login_uri = PhabricatorEnv::getURI($this->getLoginURI());

    return pht(
      "To configure Google OAuth, create a new 'API Project' here:".
      "\n\n".
      "https://code.google.com/apis/console/".
      "\n\n".
      "You don't need to enable any Services, just go to **API Access**, ".
      "click **Create an OAuth 2.0 client ID...**, and configure these ".
      "settings:".
      "\n\n".
      "  - During initial setup click **More Options** (or after creating ".
      "    the client ID, click **Edit Settings...**), then add this to ".
      "    **Authorized Redirect URIs**: `%s`\n".
      "\n\n".
      "After completing configuration, copy the **Client ID** and ".
      "**Client Secret** to the fields above.",
      $login_uri);
  }

  protected function newOAuthAdapter() {
    return new PhutilAuthAdapterOAuthGoogle();
  }

  protected function getLoginIcon() {
    return 'Google';
  }

  public function getLoginURI() {
    // TODO: Clean this up. See PhabricatorAuthOldOAuthRedirectController.
    return '/oauth/google/login/';
  }

}

<?php

final class PhabricatorAuthProviderOAuthGoogle
  extends PhabricatorAuthProviderOAuth {

  public function getProviderName() {
    return pht('Google');
  }

  public function getConfigurationHelp() {
    $login_uri = PhabricatorEnv::getURI($this->getLoginURI());

    return pht(
      "To configure Google OAuth, create a new 'API Project' here:".
      "\n\n".
      "https://console.developers.google.com/".
      "\n\n".
      "Adjust these configuration settings for your project:".
      "\n\n".
      "  - Under **APIs & auth > APIs**, scroll down the list and enable ".
      "    the **Google+ API**.\n".
      "  - Under **APIs & auth > Credentials**, click **Create New Client".
      "    ID** in the **OAuth** section. Then use these settings:\n".
      "     - **Application Type**: Web Application\n".
      "     - **Authorized Javascript origins**: Leave this empty.\n".
      "     - **Authorized redirect URI**: Set this to `%s`.\n".
      "\n\n".
      "After completing configuration, copy the **Client ID** and ".
      "**Client Secret** from the Google console to the fields above.",
      $login_uri);
  }

  protected function newOAuthAdapter() {
    return new PhutilAuthAdapterOAuthGoogle();
  }

  protected function getLoginIcon() {
    return 'Google';
  }

  public function getLoginURI() {
    // TODO: Clean this up. See PhabricatorAuthOldOAuthRedirectController.
    return '/oauth/google/login/';
  }

}

Update Google auth documentation to discuss "Google+ API" and new console URI
Update Google auth documentation to discuss "Google+ API" and new console URI

Summary: Fixes T4451. See also D8612.

Test Plan: Viewed panel and read text, saw it matched up with the new console.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4451

Differential Revision: https://secure.phabricator.com/D8613
