@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhabricatorGoogleAuthProvider
4 extends PhabricatorOAuth2AuthProvider {
5
6 public function getProviderName() {
7 return pht('Google');
8 }
9
10 protected function getProviderConfigurationHelp() {
11 $login_uri = PhabricatorEnv::getURI($this->getLoginURI());
12
13 return pht(
14 "To configure Google OAuth, create a new 'API Project' here:".
15 "\n\n".
16 "https://console.developers.google.com/".
17 "\n\n".
18 "Adjust these configuration settings for your project:".
19 "\n\n".
20 " - Under **APIs & auth > APIs**, scroll down the list and enable ".
21 " the **Google+ API**.\n".
22 " - You will need to consent to the **Google+ API** terms if you ".
23 " have not before.\n".
24 " - Under **APIs & auth > Credentials**, click **Create New Client".
25 " ID** in the **OAuth** section. Then use these settings:\n".
26 " - **Application Type**: Web Application\n".
27 " - **Authorized Javascript origins**: Leave this empty.\n".
28 " - **Authorized redirect URI**: Set this to `%s`.\n".
29 "\n\n".
30 "After completing configuration, copy the **Client ID** and ".
31 "**Client Secret** from the Google console to the fields above.",
32 $login_uri);
33 }
34
35 protected function newOAuthAdapter() {
36 return new PhutilGoogleAuthAdapter();
37 }
38
39 protected function getLoginIcon() {
40 return 'Google';
41 }
42
43 public function getLoginURI() {
44 // TODO: Clean this up. See PhabricatorAuthOldOAuthRedirectController.
45 return '/oauth/google/login/';
46 }
47
48}