hborras / twitter-php-ads-sdk

A Twitter supported and maintained Ads API SDK for PHP.
55 stars 41 forks source link

ERROR - FORBIDDEN #81

Closed ghost closed 4 years ago

ghost commented 4 years ago

Hi

I'm having problems now, everything was fine a few days ago but no it stopped working..

Hborras\TwitterAdsSDK\TwitterAds\Errors\Forbidden: FORBIDDEN in file /Users/eduardo/Projects/phd_constellation/backend/vendor/hborras/twitter-php-ads-sdk/src/TwitterAds.php on line 540

Any ideas?

Thanks

ghost commented 4 years ago

Also when I run composer update

Deprecation Notice: Class Hborras\TwitterAdsSDK\TwitterAds\Campaign\FeatureFields located in ./vendor/hborras/twitter-php-ads-sdk/src/TwitterAds/Fields/FeatureFields.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201

hborras commented 4 years ago

Hello @eblucas ,

Are you whitelisted to use TwitterAdsApi? How are you instantiating the TwitterAds class?

About the second comment. I was not aware of that change in composer v2.0. Thanks!

ghost commented 4 years ago

Hello @hborras

Yes I'm, I've been using it for over a year

$api = TwitterAds::init($this->CONSUMER_KEY, $this->CONSUMER_SECRET, $this->ACCESS_TOKEN, $this->ACCESS_TOKEN_SECRET);

    $account = new Account($this->account_id);
    $account->read();
    $campaigns = $account->getCampaigns();
hborras commented 4 years ago

It's strange then.

Have you tried to do a connection with twurl with your current credentials? I guess problem is in Twitter's side

ghost commented 4 years ago

I've tried with twurl and worked fine, very strange indeed.

-> ~ -> twurl authorize --consumer-key XXXXXXXXXXX --consumer-secret XXXXXXXXXXX Go to https://api.twitter.com/oauth/authorize?oauth_consumer_key=XXXXXXXXXXX&oauth_nonce=XXXXXXXXXXX&oauth_signature=XXXXXXXXXXX%253D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1602170839&oauth_token=XXXXXXXXXXXo&oauth_version=1.0 and paste in the supplied PIN XXXXXXXXXXX Authorization successful -> ~ ->

ghost commented 4 years ago

I spoke to twitter, they had to generate a new key for me manually and now its working. THanks for your help anyway.