mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Support Twitch.tv as an OAuth provider
Summary: This is mostly for personal reasons / lols, but they have a perfectly functional OAuth2 API and it takes like 15 minutes to add a provider now and I was in this code anyway... @chad, we could use JIRA, Twitter and Twitch.tv auth icons if you have a chance. Test Plan: {F53564} Reviewers: btrahan, chad Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D6706
This commit is contained in:
parent
d7c712a855
commit
07dd5df33b
2 changed files with 38 additions and 0 deletions
|
@ -901,6 +901,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorAuthProviderOAuthFacebook' => 'applications/auth/provider/PhabricatorAuthProviderOAuthFacebook.php',
|
||||
'PhabricatorAuthProviderOAuthGitHub' => 'applications/auth/provider/PhabricatorAuthProviderOAuthGitHub.php',
|
||||
'PhabricatorAuthProviderOAuthGoogle' => 'applications/auth/provider/PhabricatorAuthProviderOAuthGoogle.php',
|
||||
'PhabricatorAuthProviderOAuthTwitch' => 'applications/auth/provider/PhabricatorAuthProviderOAuthTwitch.php',
|
||||
'PhabricatorAuthProviderPassword' => 'applications/auth/provider/PhabricatorAuthProviderPassword.php',
|
||||
'PhabricatorAuthRegisterController' => 'applications/auth/controller/PhabricatorAuthRegisterController.php',
|
||||
'PhabricatorAuthStartController' => 'applications/auth/controller/PhabricatorAuthStartController.php',
|
||||
|
@ -2939,6 +2940,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorAuthProviderOAuthFacebook' => 'PhabricatorAuthProviderOAuth',
|
||||
'PhabricatorAuthProviderOAuthGitHub' => 'PhabricatorAuthProviderOAuth',
|
||||
'PhabricatorAuthProviderOAuthGoogle' => 'PhabricatorAuthProviderOAuth',
|
||||
'PhabricatorAuthProviderOAuthTwitch' => 'PhabricatorAuthProviderOAuth',
|
||||
'PhabricatorAuthProviderPassword' => 'PhabricatorAuthProvider',
|
||||
'PhabricatorAuthRegisterController' => 'PhabricatorAuthController',
|
||||
'PhabricatorAuthStartController' => 'PhabricatorAuthController',
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorAuthProviderOAuthTwitch
|
||||
extends PhabricatorAuthProviderOAuth {
|
||||
|
||||
public function getProviderName() {
|
||||
return pht('Twitch.tv');
|
||||
}
|
||||
|
||||
public function getConfigurationHelp() {
|
||||
$login_uri = $this->getLoginURI();
|
||||
|
||||
return pht(
|
||||
"To configure Twitch.tv OAuth, create a new application here:".
|
||||
"\n\n".
|
||||
"http://www.twitch.tv/settings/applications".
|
||||
"\n\n".
|
||||
"When creating your application, use these settings:".
|
||||
"\n\n".
|
||||
" - **Redirect URI:** Set this to: `%s`".
|
||||
"\n\n".
|
||||
"After completing configuration, copy the **Client ID** and ".
|
||||
"**Client Secret** to the fields above. (You may need to generate the ".
|
||||
"client secret by clicking 'New Secret' first.)",
|
||||
$login_uri);
|
||||
}
|
||||
|
||||
protected function newOAuthAdapter() {
|
||||
return new PhutilAuthAdapterOAuthTwitch();
|
||||
}
|
||||
|
||||
protected function getLoginIcon() {
|
||||
return 'Twitch';
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue