@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 PhabricatorAmazonAuthProvider
4 extends PhabricatorOAuth2AuthProvider {
5
6 public function getProviderName() {
7 return pht('Amazon');
8 }
9
10 protected function getProviderConfigurationHelp() {
11 $login_uri = PhabricatorEnv::getURI($this->getLoginURI());
12
13 $uri = new PhutilURI(PhabricatorEnv::getProductionURI('/'));
14 $https_note = null;
15 if ($uri->getProtocol() !== 'https') {
16 $https_note = pht(
17 'NOTE: Amazon **requires** HTTPS, but this service does '.
18 'not use HTTPS. **You will not be able to add Amazon as an '.
19 'authentication provider until you configure HTTPS on this install**.');
20 }
21
22 return pht(
23 "%s\n\n".
24 "To configure Amazon OAuth, create a new 'API Project' here:".
25 "\n\n".
26 "https://developer.amazon.com/apps-and-games/login-with-amazon".
27 "\n\n".
28 "Use these settings:".
29 "\n\n".
30 " - **Allowed Return URLs:** Add this: `%s`".
31 "\n\n".
32 "After completing configuration, copy the **Client ID** and ".
33 "**Client Secret** to the fields above.",
34 $https_note,
35 $login_uri);
36 }
37
38 protected function newOAuthAdapter() {
39 return new PhutilAmazonAuthAdapter();
40 }
41
42 protected function getLoginIcon() {
43 return 'Amazon';
44 }
45
46}