From 5e2bf7c3e4ecbad479f61f68decb286292acd3de Mon Sep 17 00:00:00 2001 From: BlackSheep Date: Mon, 29 Jan 2018 09:28:56 +0100 Subject: [PATCH] Add twitch socialite auth provider --- .env.example | 3 ++ app/Providers/EventServiceProvider.php | 1 + app/Services/SocialAuthService.php | 2 +- composer.json | 3 +- config/services.php | 7 +++ resources/assets/icons/twitch.svg | 59 ++++++++++++++++++++++++++ 6 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 resources/assets/icons/twitch.svg diff --git a/.env.example b/.env.example index ddb32c0bc..9901189b4 100644 --- a/.env.example +++ b/.env.example @@ -49,6 +49,9 @@ GOOGLE_APP_SECRET=false OKTA_BASE_URL=false OKTA_KEY=false OKTA_SECRET=false +TWITCH_KEY=false +TWITCH_SECRET=false +TWITCH_REDIRECT_URI=false # External services such as Gravatar DISABLE_EXTERNAL_SERVICES=false diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 05f9c57c1..5a690069c 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -18,6 +18,7 @@ class EventServiceProvider extends ServiceProvider 'SocialiteProviders\Slack\SlackExtendSocialite@handle', 'SocialiteProviders\Azure\AzureExtendSocialite@handle', 'SocialiteProviders\Okta\OktaExtendSocialite@handle', + 'SocialiteProviders\Twitch\TwitchExtendSocialite@handle', ], ]; diff --git a/app/Services/SocialAuthService.php b/app/Services/SocialAuthService.php index 30f7eed0e..6eb5202ae 100644 --- a/app/Services/SocialAuthService.php +++ b/app/Services/SocialAuthService.php @@ -16,7 +16,7 @@ class SocialAuthService protected $socialite; protected $socialAccount; - protected $validSocialDrivers = ['google', 'github', 'facebook', 'slack', 'twitter', 'azure', 'okta']; + protected $validSocialDrivers = ['google', 'github', 'facebook', 'slack', 'twitter', 'azure', 'okta', 'twitch']; /** * SocialAuthService constructor. diff --git a/composer.json b/composer.json index 2750b7cb3..54eb3f26c 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,8 @@ "barryvdh/laravel-snappy": "^0.4.0", "socialiteproviders/slack": "^3.0", "socialiteproviders/microsoft-azure": "^3.0", - "socialiteproviders/okta": "^1.0" + "socialiteproviders/okta": "^1.0", + "socialiteproviders/twitch": "^3.0" }, "require-dev": { "filp/whoops": "~2.0", diff --git a/config/services.php b/config/services.php index 18649c093..a630e8297 100644 --- a/config/services.php +++ b/config/services.php @@ -92,6 +92,13 @@ return [ 'redirect' => env('APP_URL') . '/login/service/okta/callback', 'base_url' => env('OKTA_BASE_URL'), 'name' => 'Okta', + ], + + 'twitch' => [ + 'client_id' => env('TWITCH_KEY'), + 'client_secret' => env('TWITCH_SECRET'), + 'redirect' => env('TWITCH_REDIRECT_URI'), + 'name' => 'Twitch', ], 'ldap' => [ diff --git a/resources/assets/icons/twitch.svg b/resources/assets/icons/twitch.svg new file mode 100644 index 000000000..0293ed9a1 --- /dev/null +++ b/resources/assets/icons/twitch.svg @@ -0,0 +1,59 @@ + + + +image/svg+xml \ No newline at end of file