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'); } }
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/'); } }
/** * 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; }
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); } }
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/'); } }
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/'); } }
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'); } }
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/'); } }
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://aimalyzer:8080/api/1.0/'); } }
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/'); } }
/** * {@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); }
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/'); } }
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()); } }
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/'); } }
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}/"); } }
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/'); } }
/** * 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(); }
/** * 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; }
/** * {@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); }
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); }
/** * {@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); }
/** * @param CredentialsInterface $credentials * @param ClientInterface $httpClient * @param TokenStorageInterface $storage * @param array $scopes * @param UriInterface $baseApiUri * @param Service $service */ public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null, Service $service) { $this->service = $service; parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, $service->getValidateState()); }
/** * {@inheritdoc} */ public function request($path, array $body = [], $method = 'GET', array $extraHeaders = []) { $uri = $this->determineRequestUriFromPath($path); $uri->getQuery()->modify(['v' => $this->apiVersionDate]); return parent::request($uri, $body, $method, $extraHeaders); }
/** * {@inheritdoc} */ public function getAuthorizationEndpoint() { $uri = parent::getAuthorizationEndpoint(); $uri->getQuery()->modify(['access_type' => $this->accessType]); return $uri; }
public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null, $apiVersion = "") { parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, true, $apiVersion); if (null === $baseApiUri) { $this->baseApiUri = new Uri('https://graph.facebook.com' . $this->getApiVersionString() . '/'); } }
/** * Retrieves and stores the OAuth2 access token after a successful authorization. * * @param string $code The access code from the callback. * @return TokenInterface $token * @throws TokenResponseException * @throws ErrorException * @throws InvalidStateException */ public function requestAccessToken($code) { if (isset($this->state) && $this->service->getValidateState()) { if (!isset($_GET['state']) || !$this->state->validateId($_GET['state'])) { throw new InvalidStateException('The valid "state" argument required.'); } } return parent::requestAccessToken($code); }
public function getAuthorizationUri(array $additionalParameters = []) { $state = uniqid(); $this->storage->storeAuthorizationState($this->service(), $state); return parent::getAuthorizationUri(array_merge(['state' => $state], $additionalParameters)); }
public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null) { parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); }