-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Victor Bocharsky <bocharsky.bw@gmail.com>
- Loading branch information
1 parent
4b7beca
commit ed13752
Showing
5 changed files
with
113 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
/* | ||
* OAuth2 Client Bundle | ||
* Copyright (c) KnpUniversity <http://knpuniversity.com/> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace KnpU\OAuth2ClientBundle\Client\Provider; | ||
|
||
use KnpU\OAuth2ClientBundle\Client\OAuth2Client; | ||
use League\OAuth2\Client\Token\AccessToken; | ||
use Vertisan\OAuth2\Client\Provider\TwitchHelixResourceOwner; | ||
|
||
class TwitchHelixClient extends OAuth2Client | ||
{ | ||
/** | ||
* @return TwitchHelixResourceOwner|\League\OAuth2\Client\Provider\ResourceOwnerInterface | ||
*/ | ||
public function fetchUserFromToken(AccessToken $accessToken) | ||
{ | ||
return parent::fetchUserFromToken($accessToken); | ||
} | ||
|
||
/** | ||
* @return TwitchHelixResourceOwner|\League\OAuth2\Client\Provider\ResourceOwnerInterface | ||
*/ | ||
public function fetchUser() | ||
{ | ||
return parent::fetchUser(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/DependencyInjection/Providers/TwitchHelixProviderConfigurator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
/* | ||
* OAuth2 Client Bundle | ||
* Copyright (c) KnpUniversity <http://knpuniversity.com/> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace KnpU\OAuth2ClientBundle\DependencyInjection\Providers; | ||
|
||
use KnpU\OAuth2ClientBundle\Client\Provider\TwitchHelixClient; | ||
use Symfony\Component\Config\Definition\Builder\NodeBuilder; | ||
use Vertisan\OAuth2\Client\Provider\TwitchHelix; | ||
|
||
/** | ||
* @Author Erdem Uyanik | ||
*/ | ||
class TwitchHelixProviderConfigurator implements ProviderConfiguratorInterface | ||
{ | ||
public function buildConfiguration(NodeBuilder $node) | ||
{ | ||
// no custom options | ||
} | ||
|
||
public function getProviderClass(array $config) | ||
{ | ||
return TwitchHelix::class; | ||
} | ||
|
||
public function getProviderOptions(array $config) | ||
{ | ||
return [ | ||
'clientId' => $config['client_id'], | ||
'clientSecret' => $config['client_secret'], | ||
]; | ||
} | ||
|
||
public function getPackagistName() | ||
{ | ||
return 'vertisan/oauth2-twitch-helix'; | ||
} | ||
|
||
public function getLibraryHomepage() | ||
{ | ||
return 'https://github.com/vertisan/oauth2-twitch-helix'; | ||
} | ||
|
||
public function getProviderDisplayName() | ||
{ | ||
return 'Twitch Helix'; | ||
} | ||
|
||
public function getClientClass(array $config) | ||
{ | ||
return TwitchHelixClient::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters