作者:ZeusWP
项目:dokuwiki-plugin-oaut
/**
* Request access token
*
* This is the second step of oAuth authentication
*
* This implementation tries to abstract away differences between oAuth1 and oAuth2,
* but might need to be overwritten for specific services
*
* @return bool
*/
public function checkToken()
{
global $INPUT;
if (is_a($this->oAuth, 'OAuth\\OAuth2\\Service\\AbstractService')) {
/* oAuth2 handling */
if (!$INPUT->get->has('code')) {
return false;
}
$state = $INPUT->get->str('state', null);
try {
$this->oAuth->requestAccessToken($INPUT->get->str('code'), $state);
} catch (TokenResponseException $e) {
msg($e->getMessage(), -1);
return false;
}
} else {
/* oAuth1 handling */
if (!$INPUT->get->has('oauth_token')) {
return false;
}
$token = $this->storage->retrieveAccessToken($this->getServiceName());
// This was a callback request from BitBucket, get the token
try {
$this->oAuth->requestAccessToken($INPUT->get->str('oauth_token'), $INPUT->get->str('oauth_verifier'), $token->getRequestTokenSecret());
} catch (TokenResponseException $e) {
msg($e->getMessage(), -1);
return false;
}
}
return true;
}
作者:supergravity-or
项目:dokuwiki-plugin-oaut
/**
* Request access token
*
* This is the second step of oAuth authentication
*
* This implementation tries to abstract away differences between oAuth1 and oAuth2,
* but might need to be overwritten for specific services
*
* @return bool
*/
public function checkToken()
{
global $INPUT;
if (is_a($this->oAuth, 'OAuth\\OAuth2\\Service\\AbstractService')) {
/* oAuth2 handling */
if (!$INPUT->get->has('code')) {
return false;
}
$state = $INPUT->get->str('state', null);
try {
$this->oAuth->requestAccessToken($INPUT->get->str('code'), $state);
} catch (TokenResponseException $e) {
msg($e->getMessage(), -1);
return false;
}
} else {
/* oAuth1 handling */
if (!$INPUT->get->has('oauth_token')) {
return false;
}
$token = $this->storage->retrieveAccessToken($this->getServiceName());
// This was a callback request from BitBucket, get the token
try {
$this->oAuth->requestAccessToken($INPUT->get->str('oauth_token'), $INPUT->get->str('oauth_verifier'), $token->getRequestTokenSecret());
} catch (TokenResponseException $e) {
msg($e->getMessage(), -1);
return false;
}
}
$validDomains = $this->hlp->getValidDomains();
if (count($validDomains) > 0) {
$userData = $this->getUser();
if (!$this->hlp->checkMail($userData['mail'])) {
msg(sprintf($this->hlp->getLang("rejectedEMail"), join(', ', $validDomains)), -1);
send_redirect(wl('', array('do' => 'login'), false, '&'));
}
}
return true;
}
作者:DevSlashNul
项目:PHPoAuthLi
public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
{
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, true);
if (null === $baseApiUri) {
$this->baseApiUri = new Uri('https://oauth.reddit.com');
}
}
作者:freaktechni
项目:PHPoAuthLi
public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null, $apiVersion = "v3")
{
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, true, $apiVersion);
if (null === $baseApiUri) {
$this->baseApiUri = new Uri('https://api.twitch.tv/kraken/');
}
}
作者:RewardGatewa
项目:PHPoAuthLi
public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
{
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
if ($baseApiUri === null) {
$this->baseApiUri = new Uri(self::API_URI_US);
}
}
作者:DevSlashNul
项目:PHPoAuthLi
public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
{
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
if ($baseApiUri === null) {
$this->baseApiUri = new Uri('https://getpocket.com/v3/');
}
}
作者:davenorthcree
项目:stratu
public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
{
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
if (null === $baseApiUri) {
$this->baseApiUri = new Uri('http://rest.bullhornstaffing.com/rest-services/');
}
}
作者:vutha
项目:nukeviet-oauth
public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null, $apiVersion = "")
{
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, false, $apiVersion);
if (null === $baseApiUri) {
$this->baseApiUri = new Uri('http://server.oauth2.nukeviet.vn/oauth2/resource');
}
}
作者:paliar
项目:oauth2-client-facad
public function __construct(Credentials $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
{
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
if (null === $baseApiUri) {
$this->baseApiUri = new Uri(static::BASE_URL . 'resource/');
}
}
作者:Type-of-Rea
项目:Readability-API-
public function __construct(\OAuth\Common\Consumer\CredentialsInterface $credentials, \OAuth\Common\Http\Client\ClientInterface $httpClient, \OAuth\Common\Storage\TokenStorageInterface $storage, $scopes = array(), \OAuth\Common\Http\Uri\UriInterface $baseApiUri = null)
{
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
if (null === $baseApiUri) {
$this->baseApiUri = new Uri('https://www.readability.com/api/rest/v1/');
}
}
作者:vladvot
项目:productclas
/**
* {@inheritdoc}
*/
public function request($path, $method = 'GET', $body = null, array $extraHeaders = array())
{
if (is_null($this->baseApiUri)) {
$this->setBaseApiUri($this->storage->retrieveAccessToken($this->service()));
}
return parent::request($path, $method, $body, $extraHeaders);
}
作者:Tarenda
项目:spring-websit
public function __construct(Credentials $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
{
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
if (null === $baseApiUri) {
$this->baseApiUri = new Uri('https://api.paypal.com/v1/');
}
}
作者:artis-mostie
项目:oauth-ph
public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = [], UriInterface $baseApiUri = null, $apiVersion = "")
{
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, false, $apiVersion);
$this->apiVersion = "v1";
if (is_null($baseApiUri)) {
$this->baseApiUri = new Uri(self::API_URL . $this->getApiVersionString());
}
}
作者:bastian
项目:phpbb-ext-evess
public function __construct(Credentials $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
{
$scopes = array();
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
if (null === $baseApiUri) {
$this->baseApiUri = new Uri('https://sisilogin.testeveonline.com/oauth/');
}
}
作者:aranam
项目:dokuwiki-plugin-oaut
public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
{
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
$hlp = plugin_load('helper', 'oauth');
$this->domain = $hlp->getConf('auth0-domain');
if (null === $baseApiUri) {
$this->baseApiUri = new Uri("https://{$this->domain}/");
}
}
作者:clee0
项目:meta
public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
{
if (empty($scopes)) {
$scopes = array(self::SCOPE_PUBLIC);
}
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, true);
if (null === $baseApiUri) {
$this->baseApiUri = new Uri('https://www.strava.com/api/v3/');
}
}
作者:Flesh19
项目:magent
/**
* Returns a class constant from ServiceInterface defining the authorization method used for the API
* Header is the sane default.
*
* @return int
*/
protected function getAuthorizationMethod()
{
switch ($this->authorizationMethod) {
case 'querystring':
return static::AUTHORIZATION_METHOD_QUERY_STRING;
case 'querystring2':
return static::AUTHORIZATION_METHOD_QUERY_STRING_V2;
case 'bearer':
return static::AUTHORIZATION_METHOD_HEADER_BEARER;
}
return parent::getAuthorizationMethod();
}
作者:DevSlashNul
项目:PHPoAuthLi
/**
* {@inheritdoc}
*/
public function request($path, $method = 'GET', $body = null, array $extraHeaders = array())
{
$uri = $this->determineRequestUriFromPath($path, $this->baseApiUri);
$uri->addToQuery('v', $this->apiVersionDate);
return parent::request($uri, $method, $body, $extraHeaders);
}
作者:raych
项目:PHPoAuthLi
public function request($path, $method = 'GET', $body = null, array $extraHeaders = array())
{
$params = ['oauth_token' => 'qyprd3VVTi05a8Ukbv2DNO2Z2CP1CwflHHrGUiAOyPMQ1CTB', 'oauth_nonce' => $this->_nonce(), 'oauth_consumer_key' => $this->credentials->getConsumerId(), 'oauth_signature_method' => 'HMAC-SHA1', 'oauth_timestamp' => time(), 'oauth_version' => '1.0'];
$responseBody = $this->httpClient->retrieveResponse(new Uri(\Config::get('intuit.url') . $path), $params, $extraHeaders);
dd($responseBody);
array_walk($params, function (&$val, &$key) {
$key = strtolower($key);
$val = strtolower($key) . '=' . $val;
});
return parent::request($path, $method, $body, $extraHeaders);
}
作者:shabbirvividad
项目:magento
/**
* {@inheritdoc}
*/
public function request($path, $method = 'GET', $body = null, array $extraHeaders = array())
{
$uri = new Uri($this->baseApiUri . $path);
$uri->addToQuery('v', $this->apiVersionDate);
return parent::request($uri, $method, $body, $extraHeaders);
}