xdevplatform / twitter-python-ads-sdk

A Twitter supported and maintained Ads API SDK for Python.
https://twitterdev.github.io/twitter-python-ads-sdk/
MIT License
188 stars 106 forks source link

Getting 'This request is not properly authenticated' error #111

Closed MathewDominic closed 7 years ago

MathewDominic commented 7 years ago

I was following the quick_start.py guide. I have provided CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET from the twitter app that I created and ACCOUNT_ID as the id of the account in which I have created my campaigns.

account = client.accounts(ACCOUNT_ID)

The above line gives me the following error:- NotAuthorized: <NotAuthorized object at 0x1109bc410 code=401 details=[{u'message': u'This request is not properly authenticated', u'code': u'UNAUTHORIZED_ACCESS'}]>

I have requested and have been granted access to use the twitter ads API. I also have authorised my keys using twurl. Is there anything I'm missing? Any help would be greatly appreciated

juanshishido commented 7 years ago

@MathewDominic: What's the ID for the app you're using?

By the way, please consider using the Twitter developer forums in the future. Your questions will get much more visibility. In addition, you'll find that, in many cases, your questions may have already been asked and answered.

MathewDominic commented 7 years ago

@juanshishido Thanks for the reply. My app ID is 13572389. I will also search in the forum that you've mentioned.

juanshishido commented 7 years ago

Thanks. I see that you have, indeed, been granted access.

Are requests made using twurl successful? If so, it's likely an issue with your authentication credentials. See this FAQ for more information. Make sure that the credentials you're using in the Python SDK match what you see in ~/.twurlrc.

MathewDominic commented 7 years ago

the suggestion to check ~/.twurlrc worked. The access token I was using was wrong. Thanks again for your help