Created
December 19, 2013 18:01
-
-
Save PeeHaa/8043525 to your computer and use it in GitHub Desktop.
Etsy is being a dickhead with its non standard scope implementation. What a dick move
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
<?php | |
use OAuth\OAuth1\Service\Etsy; | |
use OAuth\OAuth1\Signature\SignatureInterface; | |
use OAuth\Common\Consumer\CredentialsInterface; | |
use OAuth\Common\Http\Uri\UriInterface; | |
use OAuth\Common\Storage\TokenStorageInterface; | |
use OAuth\Common\Http\Client\ClientInterface; | |
class CustomEtsy extends Etsy | |
{ | |
protected $scopes; | |
public function __construct( | |
CredentialsInterface $credentials, | |
ClientInterface $httpClient, | |
TokenStorageInterface $storage, | |
SignatureInterface $signature, | |
UriInterface $baseApiUri = null, | |
array $scopes = array() | |
) { | |
parent::__construct($credentials, $httpClient, $storage, $signature, $baseApiUri); | |
if (null === $baseApiUri) { | |
$this->baseApiUri = new Uri('http://openapi.etsy.com/v2/'); | |
} | |
$this->scopes = $scopes; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function getRequestTokenEndpoint() | |
{ | |
$scopes = ''; | |
if ($this->scopes) { | |
$scopes = '?' . implode('&', $this->scopes); | |
} | |
return new Uri($this->baseApiUri . 'oauth/request_token' . $scopes); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is this an implementation of the Lusitanian/PHPoAuthLib ?