public function authenticateApp ($consumer_key, $consumer_secret) {

        $bearer_token = $this->encodeBearer($consumer_key, $consumer_secret);

        // Twitter Required Headers
        $headers = array(
            'Authorization' => 'Basic ' . $bearer_token,
            'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8'
        );

        // Twitter Required Body
        $body = 'grant_type=client_credentials';
        
        $response = $this->client->post('/oauth2/token', $headers, $body)->send();
        $data = $response->json();
        $this->bearer = $data['access_token'];
        return $this->bearer;
    }
public function authenticateApp ($consumer_key, $consumer_secret) {

        $bearer_token = $this->encodeBearer($consumer_key, $consumer_secret);

        // Twitter Required Headers
        $headers = array(
            'Authorization' => 'Basic ' . $bearer_token,
            'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8'
        );

        // Twitter Required Body
        $body = 'grant_type=client_credentials';
        
        $response = $this->client->post('/oauth2/token', $headers, $body)->send();
        $data = $response->json();
        $this->bearer = $data['access_token'];
        return $this->bearer;
    }
public function authenticateApp ( $ consumer_key , $ consumer_secret ) { $ bearer_token = $ this -> encodeBearer ( $ consumer_key , $ consumer_secret ) ; // Twitter Required Headers $ headers = array ( 'Authorization' => 'Basic ' . $ bearer_token , 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8' ) ; // Twitter Required Body $ body = 'grant_type=client_credentials' ; $ response = $ this -> client -> post ( '/oauth2/token' , $ headers , $ body ) -> send ( ) ; $ data = $ response -> json ( ) ; $ this -> bearer = $ data [ 'access_token' ] ; return $ this -> bearer ; }
Calling this method will establish the hand shake with Twitter OAuth as an application
and return this sessions Bearer Token to be used for the call being made
@param  [string] $consumer_key    Your Twitter Application Consumer Key
@param  [string] $consumer_secret Your Twitter Application Consumer Secret Key
@return [string]                  Twitter OAuth Bearer Access Token
Calling this method will establish the hand shake with Twitter OAuth as an application and return this sessions Bearer Token to be used for the call being made