-
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.
Merge pull request #33 from bocharsky-bw/instagram
Add Instagram provider
- Loading branch information
Showing
4 changed files
with
101 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace KnpU\OAuth2ClientBundle\Client\Provider; | ||
|
||
use KnpU\OAuth2ClientBundle\Client\OAuth2Client; | ||
use League\OAuth2\Client\Provider\InstagramResourceOwner; | ||
use League\OAuth2\Client\Token\AccessToken; | ||
|
||
class InstagramClient extends OAuth2Client | ||
{ | ||
/** | ||
* @param AccessToken $accessToken | ||
* @return InstagramResourceOwner | ||
*/ | ||
public function fetchUserFromToken(AccessToken $accessToken) | ||
{ | ||
return parent::fetchUserFromToken($accessToken); | ||
} | ||
|
||
/** | ||
* @return InstagramResourceOwner | ||
*/ | ||
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
48 changes: 48 additions & 0 deletions
48
DependencyInjection/Providers/InstagramProviderConfigurator.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,48 @@ | ||
<?php | ||
|
||
namespace KnpU\OAuth2ClientBundle\DependencyInjection\Providers; | ||
|
||
use KnpU\OAuth2ClientBundle\Client\Provider\InstagramClient; | ||
use League\OAuth2\Client\Provider\Instagram; | ||
use Symfony\Component\Config\Definition\Builder\NodeBuilder; | ||
|
||
class InstagramProviderConfigurator implements ProviderConfiguratorInterface | ||
{ | ||
public function buildConfiguration(NodeBuilder $node) | ||
{ | ||
// no options... | ||
} | ||
|
||
public function getProviderClass(array $config) | ||
{ | ||
return Instagram::class; | ||
} | ||
|
||
public function getProviderOptions(array $config) | ||
{ | ||
return array( | ||
'clientId' => $config['client_id'], | ||
'clientSecret' => $config['client_secret'], | ||
); | ||
} | ||
|
||
public function getPackagistName() | ||
{ | ||
return 'league/oauth2-instagram'; | ||
} | ||
|
||
public function getLibraryHomepage() | ||
{ | ||
return 'https://github.com/thephpleague/oauth2-instagram'; | ||
} | ||
|
||
public function getProviderDisplayName() | ||
{ | ||
return 'Instagram'; | ||
} | ||
|
||
public function getClientClass(array $config) | ||
{ | ||
return InstagramClient::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