Unauthorized_client_application

oauth

#1

Hi there,

I’m trying to do some testing with the sandbox environment. I’ve trawled through multiple posts all over the boards but I can’t seem to find a solution. I’ve made sure that

  • My application has been granted developer access
  • I’ve set up my twurl authentication correctly
  • I’m using the right request
  • I’m using the right account

but I keep encountering this error:

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

Some assistance would be greatly appreciated.

Application ID: 14669156
Post Request:

twurl -H ads-api-sandbox.twitter.com -d "start_time=2013-05-09T00:00:00Z&funding_instrument_id="hxx9k"&name=My First Campaign&total_budget_amount_local_micro=500000000&daily_budget_amount_local_micro=50000000" /2/accounts/gq1aoz/campaigns/

#2

Hi,

Thanks for trying to find the answer to this issue.

Have you tried making a request to ads-api.twitter.com and not the sandbox host domain? I just want to make sure that’s not the problem here.

I checked your App ID quickly and it looks like it’s whitelisted correctly - usually the problem in this case is the Twitter handle you auth is different than the one associated with your App ID ‘inadvertantly’. Can you please check oauth_consumer_key= from the signature headers when you run twurl with ‘-t’ debug flag and diff it to the one you expect (starts with DYFwu…)?

If it’s still not working - I will go ahead and escalate this to double check the app ID settings.

Thanks,

John


#3

Hi John,

Thanks for getting back to me. My application Oauth consumer key corresponds with the one appearing in the signature headers for requests to both ads-api.twitter.com and ads-api-sandbox.twitter.com.

I did change my twitter handle at some point, but i refreshed my application keys and started again from scratch. This might be a long shot, but maybe it has something to do with the fact that i changed my handle during the period I requested for access to the ads api?

Please advise.

Regards,
Greg


#4

You can try to regenerate the key and secret (there is a button to do it on apps.twitter.com under “Keys and Access Tokens” tab) which if you don’t already have users using your app shouldn’t cause you too many problems other than repeating the step on twurl to auth and enter the consumer key / secret again (which looks something like twurl authorize --consumer-key fookey --consumer-secret foosecret ).

You can also inspect the .twurlrc and see what these are set as by hand per each handle you have authed. The structure of the .twurlrc file is similar to how you would need to store user tokens to access multiple ad accounts. Also you can try to just make sure ruby env or twurl version itself don’t need to be updated but that’s a very rare case (there was a case a long time ago where a certain version of Ruby was causing OAuth problems), that shouldn’t affect using SDK either, so someone would go ahead and double check the App ID settings if you are still having issues.

Hope that helps though!


#5

Hi John,

I’m running twurl 0.9.3 and ruby 2.5.0, both the latest versions. Regenerated my keys, re-authorized and reset the default key to the new one as well, no luck there either.

Gonna need some help here.

Regards,
Greg


#6

Hi John,

Just wanna check if anyone is following up with my request. Would be great if I could get an update on the issue at hand.

Regards,
Greg


#7

Hi,

Still unable to resolve this issue on my own. Would really appreciate a response.

Regards,
Greg


#8

Sorry for the delay in replying - I actually found out your whitelisting is set up correctly, but it was set up as a ‘read only’ partner that would only have access to analytics. You would be able to post to get analytics via Async Jobs endpoint, but those campaign management POST endpoints will give the error you see above. If you wanted campaign management and not just analytics access - the program manager who whitelists will have to update the settings. Sorry for the confusion there!

Thanks,

John


#9