Closed cipljigna closed 7 years ago
Hi Jigna,
I've updated your comment in order to hide your personal information. Don't share your tokens keys.
Regarding to the error. Do you get any exception? Have you connected before with the ads api with TWURL or another app?
Thanks
HI hborras,
Thanks for hiding my info. I have checked and i am getting now following error.
Fatal error: Uncaught Hborras\TwitterAdsSDK\TwitterAds\Errors\NotAuthorized: NOT_AUTHORIZED.
Do you know how i can authorize or give permission to my Ad account. Can you please share TURL sample code in php. How i can fetch camping's detils, ads list, ads click, etc.
Thanks in advance.
Hi Jigna,
Do you have your app whitelisted for Twitter Ads API?
It could be also a mistake in the access tokens.
Go here https://apps.twitter.com/app/{{your_app_id}}/keys
And regenerate them
HI Hborras,
i have done changes as per you request but still facing same error. I also trying to solve this from my end.
Fatal error: Uncaught Hborras\TwitterAdsSDK\TwitterAds\Errors\NotAuthorized: NOT_AUTHORIZED in httpdocs/twitter_ads/src/TwitterAds.php:428 Stack trace: #0 httpdocs/twitter_ads/src/TwitterAds.php(408): Hborras\TwitterAdsSDK\TwitterAds->manageErrors(Object(stdClass)) #1 httpdocs/twitter_ads/src/TwitterAds.php(221): Hborras\TwitterAdsSDK\TwitterAds->http('GET', 'https://ads-api...', 'accounts/18ce54...', Array) #2 httpdocs/twitter_ads/src/TwitterAds/Account.php(71): Hborras\TwitterAdsSDK\TwitterAds->get('accounts/18ce54...', Array) #3 httpdocs/twitter_ads/src/TwitterAds.php(88): Hborras\TwitterAdsSDK\TwitterAds\Account->load('18ce54hdiwf') #4 /httpdocs/twitter_ads/examples/quick_start.php(22): Hborras\TwitterAdsSDK\TwitterAds->getAccounts('18ce54hdiwf') #5 {main} thrown in /httpdocs/twitter_ads/src/TwitterAds.php on line 428
Thanks
Hi Jigna,
I think I know what the problem is.
Could it be that, the account you have selected '18ce54hdiwf', you don't have access with your user?
I explain:
There're two ways to connect in Twitter Ads API with one Ads Account.
1 - A user creates an APP, (like your app) and use the access tokens provided in the page I've pointed before. Is NECESSARY to: for the user that has created the app, to be allowed to manage that Ad Account.
2 - A user creates an APP, and connect with other user, obtain new ACCESS_TOKEN and ACCESS_TOKEN_SECRET and use their access tokens CONSUMER_KEY and CONSUMER_SECRET are equal (because they are related to the app). This is something that you should do on your end.
With this lib you can switch between accounts, but the connection should be done in your end.
Tell me if this helped you!
Thanks
Hi There,
I am trying to fetch account details through "quick_start.php" but i am not getting any data. Please see below details for your reference.
const CONSUMER_KEY = ''; const CONSUMER_SECRET = ''; const ACCESS_TOKEN = ' '; const ACCESS_TOKEN_SECRET = ''; const ACCOUNT_ID = '';
// Create twitter ads client $twitterAds = new TwitterAds(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);
// Retrieve account information $account = $twitterAds->getAccounts(ACCOUNT_ID); print_r($account);
In $account, i am not getting any data.
Thanks in advance. Jigna Mandaliya