New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facing issue in getting account details #25

Closed
cipljigna opened this Issue Apr 17, 2017 · 5 comments

Comments

Projects
None yet
2 participants
@cipljigna

cipljigna commented Apr 17, 2017

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

@hborras

This comment has been minimized.

Owner

hborras commented Apr 17, 2017

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

@cipljigna

This comment has been minimized.

cipljigna commented Apr 17, 2017

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.

@hborras

This comment has been minimized.

Owner

hborras commented Apr 17, 2017

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

@cipljigna

This comment has been minimized.

cipljigna commented Apr 17, 2017

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

@hborras

This comment has been minimized.

Owner

hborras commented Apr 18, 2017

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

@hborras hborras closed this May 3, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment