Application-only authentication


#1

Can you verify if the Ads API works
with Application-only authentication? I’m able to get a valid ‘bearer’ token,
but then I get the following error when I try to make a call with the bearer
token:

{“errors”:[{“code”:“UNAUTHORIZED_CLIENT_APPLICATION”,“message”:“The
client application making this request does not have access to this
API”}],“request”:{“params”:{}}}


What OAuth 1 or 2 should I choose in order to perform campaign analytics?
#2

Hi @coreyac

Ads API does not support app-only authentication. User context is required for all Ads API activity. Here’s some more info: https://dev.twitter.com/ads/campaigns#HTTP_OAuth


#3

Thanks @jillblaz, I’ve tried the full OAUTH flow as well, but I still get the same error (I now see my screen name appended to the end of the error though). Is there any way to verify if my app has been whitelisted?


#4

Hi. I’m seeing the same error as well when trying to query https://ads-api.twitter.com/oauth/request_token with our api key/secret (also providing the oauth_callback parameter) - is there a problem or am i doing something wrong?


#5

@dimapv Looks like you may have an incorrect base URL. According to https://dev.twitter.com/ads/campaigns/getting-started, “OAuth for the Ads API is handled by the same system as the Twitter API.” Would love to hear if you’re able to get things working using https://api.twitter.com/oauth/request_token


#6

I’m getting the same error when trying to retrieve my accounts via a terminal (cURL command: curl --get ‘https://ads-api.twitter.com/0/accounts’ --header 'Authorization: OAuth oauth_consumer_key=…) and through a web browser (https://ads-api.twitter.com/0/accounts&oauth_consumer_key=…) .


#7

Yeah, these all sound like OAuth issues.

@dimapv @coreyac - Can you please provide full requests and responses (feel free to redact personal info). It’s hard to tell what is going on without those details.

@TaliDolev - Have you tried using twurl instead of curl to test? twurl will take care of the header for you and likely make troubleshooting OAuth easier.


#8

@jillblaz - I tried twurl and got the “Authorization Successful” message. I’m also able to run the example commands (twurl /1.1/statuses/home_timeline.json; twurl account)

But I can’t get the ads api commands to work. I tried a few different combinations, but continue to get the same error. For example: twurl -H ads-api.twitter.com campaigns
{“errors”:[{“code”:“UNAUTHORIZED_CLIENT_APPLICATION”,“message”:“The client application making this request does not have access to this API”}],“request”:{“params”:{}}}


#9

@TaliDolev @dimapv @coreyac Ok, I’ve confirmed the whitelisting for each of your organization’s accounts and ran the process again. Please try access the Ads API now.


#10

I’m in! Thanks @jillblaz


#11

Cool, it works!

As @coreyac suggested the oauth is done against the api.twitter.com domain, thanks!


#12

Worked for me too! thanks @jillblaz


#13

Hi @jillblaz!

It seems we’re running into the same whitelisting-issue. While I’m able to get data from endpoints like accounts, targeting_data and funding_instruments, I get “UNAUTHORIZED_CLIENT_APPLICATION” when I try to create a campaign - write access is apparently denied.

I’m using twurl, the sandbox API and an access-token (with read-write access perms) of the organization the Application belongs to.

May you check the Applications my user granted access to?

Thanks!


#14

@jillblaz nevermind - just read you forum policy concerning discussion of access levels


#15