protected function requestAppAccessToken()
    {
        $credentials = $this->authHelper->generateAppCredentials($this->apiKey, $this->apiSecret);

        $endpoint = '/oauth2/token';

        $url = $this->urlHelper->joinSlugs([$this->baseUrl, $endpoint]);

        $data = ['grant_type' => 'client_credentials'];

        $headers = [
            'Authorization' => 'Basic ' . $credentials,
            'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8'
        ];

        $response = $this->courier->post($url, $data, $headers)->toArray();

        return $response['access_token'];
    }
protected function requestAppAccessToken()
    {
        $credentials = $this->authHelper->generateAppCredentials($this->apiKey, $this->apiSecret);

        $endpoint = '/oauth2/token';

        $url = $this->urlHelper->joinSlugs([$this->baseUrl, $endpoint]);

        $data = ['grant_type' => 'client_credentials'];

        $headers = [
            'Authorization' => 'Basic ' . $credentials,
            'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8'
        ];

        $response = $this->courier->post($url, $data, $headers)->toArray();

        return $response['access_token'];
    }
protected function requestAppAccessToken ( ) { $ credentials = $ this -> authHelper -> generateAppCredentials ( $ this -> apiKey , $ this -> apiSecret ) ; $ endpoint = '/oauth2/token' ; $ url = $ this -> urlHelper -> joinSlugs ( [ $ this -> baseUrl , $ endpoint ] ) ; $ data = [ 'grant_type' => 'client_credentials' ] ; $ headers = [ 'Authorization' => 'Basic ' . $ credentials , 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8' ] ; $ response = $ this -> courier -> post ( $ url , $ data , $ headers ) -> toArray ( ) ; return $ response [ 'access_token' ] ; }
Request an app access token

@link https://dev.twitter.com/docs/api/1.1/post/oauth2/token

@throws TwitterException
@return string
Request an app access token