Beispiel #1
0
 public function testGetBearerTokenSuccessReturn()
 {
     //Replace with your own key/secret in order to test
     $key = $this->key;
     $secret = $this->secret;
     $uri = 'https://api.twitter.com/oauth2/token';
     $body = 'grant_type=client_credentials';
     $oauth = new OAuth($key, $secret, $uri, $body);
     $token = $oauth->getBearerToken();
     $this->assertInternalType('string', $token);
     return $oauth;
 }
Beispiel #2
0
 /**
  * This generates the headers neccessary to communicate with
  * the Twitter REST API.
  *
  * @return string[] Returns the header array used to authenticate
  */
 protected function generateHeader()
 {
     $header = [];
     $header[] = 'Authorization: Bearer ' . $this->oauth->getBearerToken();
     return $header;
 }