You are here

public function TweetFetcher::setCredentials in Media entity Twitter 8

Same name and namespace in other branches
  1. 8.2 src/TweetFetcher.php \Drupal\media_entity_twitter\TweetFetcher::setCredentials()

Sets the credentials for accessing Twitter's API.

Parameters

string $consumer_key: The consumer key.

$consumer_secret: The consumer secret.

string $oauth_access_token: The OAuth access token.

string $oauth_access_token_secret: The OAuth access token secret.

Overrides TweetFetcherInterface::setCredentials

File

src/TweetFetcher.php, line 95

Class

TweetFetcher
Fetches (and caches) tweet data from Twitter's API.

Namespace

Drupal\media_entity_twitter

Code

public function setCredentials($consumer_key, $consumer_secret, $oauth_access_token, $oauth_access_token_secret) {
  $this->credentials = [
    'consumer_key' => $consumer_key,
    'consumer_secret' => $consumer_secret,
    'oauth_access_token' => $oauth_access_token,
    'oauth_access_token_secret' => $oauth_access_token_secret,
  ];
  $this->twitter = new \TwitterAPIExchange($this->credentials);
}