Fetching scheduled tweets: UNAUTHORIZED_CLIENT_APPLICATION

creative

#1

Hi guys!

When trying to fetch data for https://ads-api.twitter.com/2/accounts/:account_id/scheduled_tweets the following error is returned:
"code":"UNAUTHORIZED_CLIENT_APPLICATION","message":"The client application making this request does not have access to this API"

Do we need any additional permissions to fetch the scheduled tweets from the Creatives part of the Ads API?

Thanks!


#2

@Tianape: Thanks for the question. Please ensure that you’re using the credentials for the app that has access to the Ads API. There are no additional permissions required for Scheduled Tweets. Are you able to make a request to the GET accounts endpoint successfully?


#3

Hi @juanshishido,

Thank you for your reply! Yes, we’re able to make requests to GET accounts, GET accounts/:account_id/campaigns, GET stats/accounts/:account_id, etc. perfectly fine. So far it’s just Scheduled Tweets, but I’ll try some other endpoints listed under the Creative part of the API!


#4

That’s strange. Do let us know if you continue seeing this issue. We want to make sure you’re unblocked.

If you do need a follow up, please provide two example requests using twurl and the -t flag:

  1. GET accounts
  2. GET accounts/:account_id/scheduled_tweets

Thanks!


#5

I’m still seeing the issue, though so far it’s only for GET accounts/:account_id/scheduled_tweets. Tried with other Creative endpoints such as GET accounts/:account_id/account_media, but those do work.

I censored some info such as tokens. Let me know if there’s any way I can send you the non-censored version.

Twurl info:

  1. GET accounts
twurl -H ads-api.twitter.com /2/accounts -t
opening connection to ads-api.twitter.com:443...
opened
starting SSL for ads-api.twitter.com:443...
SSL established
<- "GET /2/accounts HTTP/1.1\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nUser-Agent: OAuth gem v0.4.7\r\nContent-Type: application/x-www-form-urlencoded\r\nAuthorization: OAuth oauth_consumer_key=\"VALUE_REDACTED\", oauth_nonce=\"VALUE_REDACTED\", oauth_signature=\"VALUE_REDACTED\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1512726486\", oauth_token=\"VALUE_REDACTED\", oauth_version=\"1.0\"\r\nConnection: close\r\nHost: ads-api.twitter.com\r\nContent-Length: 0\r\n\r\n"
<- ""
-> "HTTP/1.1 200 OK\r\n"
-> "connection: close\r\n"
-> "content-disposition: attachment; filename=json.json\r\n"
-> "content-encoding: gzip\r\n"
-> "content-length: 273\r\n"
-> "content-type: application/json;charset=utf-8\r\n"
-> "date: Fri, 08 Dec 2017 09:46:27 GMT\r\n"
-> "server: tsa_b\r\n"
-> "set-cookie: personalization_id=\"v1_S9F3tQRJT5WWvAuCSfloXA==\"; Expires=Sun, 08 Dec 2019 09:46:27 UTC; Path=/; Domain=.twitter.com\r\n"
-> "set-cookie: guest_id=v1%3A151272638751260163; Expires=Sun, 08 Dec 2019 09:46:27 UTC; Path=/; Domain=.twitter.com\r\n"
-> "strict-transport-security: max-age=631138519\r\n"
-> "x-access-level: read-write\r\n"
-> "x-api-version: 2.0\r\n"
-> "x-connection-hash: 94ec484f12f83aed088694ab258767ed\r\n"
-> "x-content-type-options: nosniff\r\n"
-> "x-current-api-version: 2.0\r\n"
-> "x-frame-options: SAMEORIGIN\r\n"
-> "x-rate-limit-limit: 2000\r\n"
-> "x-rate-limit-remaining: 1999\r\n"
-> "x-rate-limit-reset: 1512727287\r\n"
-> "x-response-time: 20\r\n"
-> "x-runtime: 0.006778\r\n"
-> "x-transaction: 0085a89600b199e9\r\n"
-> "x-xss-protection: 1; mode=block\r\n"
-> "\r\n"
reading 273 bytes...
-> ""
-> {"request":{"params":{}},"next_cursor":null,"data":[{"name":"VALUE_REDACTED",
 [KEYS_REMOVED_FOR_READABILITY] ,"approval_status":"ACCEPTED","deleted":false}]}read 273 bytes
Conn close
  1. GET accounts/:account_id/scheduled_tweets
twurl -H ads-api.twitter.com /2/accounts/18ce53wse4d/scheduled_tweets -t
opening connection to ads-api.twitter.com:443...
opened
starting SSL for ads-api.twitter.com:443...
SSL established
<- "GET /2/accounts/18ce53wse4d/scheduled_tweets HTTP/1.1\r\nAccept-Encoding: 
*/*\r\nUser-Agent: OAuth gem v0.4.7\r\nContent-Type: application/x-www-form-urlencoded\r\nAuthorization: OAuth oauth_consumer_key=\"VALUE_REDACTED\", oauth_nonce=\"VALUE_REDACTED\", oauth_signature=\"VALUE_REDACTED\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1512726486\", oauth_token=\"VALUE_REDACTED\", oauth_version=\"1.0\"\r\nConnection: close\r\nHost: ads-api.twitter.com\r\nContent-Length: 0\r\n\r\n"
<- ""
-> "HTTP/1.1 403 Forbidden\r\n"
-> "connection: close\r\n"
-> "content-disposition: attachment; filename=json.json\r\n"
-> "content-encoding: gzip\r\n"
-> "content-length: 166\r\n"
-> "content-type: application/json;charset=utf-8\r\n"
-> "date: Fri, 08 Dec 2017 09:46:59 GMT\r\n"
-> "server: tsa_b\r\n"
-> "set-cookie: personalization_id=\"v1_wQEDhzxCWOrfAld37qY2sg==\"; Expires=Sun, 08 Dec 2019 09:46:59 UTC; Path=/; Domain=.twitter.com\r\n"
-> "set-cookie: guest_id=v1%3A151272641927680139; Expires=Sun, 08 Dec 2019 09:46:59 UTC; Path=/; Domain=.twitter.com\r\n"
-> "strict-transport-security: max-age=631138519\r\n"
-> "x-access-level: read-write\r\n"
-> "x-api-version: 2.0\r\n"
-> "x-connection-hash: 8532eb970318d58a11026cdaf913854a\r\n"
-> "x-content-type-options: nosniff\r\n"
-> "x-current-api-version: 2.0\r\n"
-> "x-frame-options: SAMEORIGIN\r\n"
-> "x-rate-limit-limit: 2000\r\n"
-> "x-rate-limit-remaining: 1999\r\n"
-> "x-rate-limit-reset: 1512727319\r\n"
-> "x-response-time: 17\r\n"
-> "x-runtime: 0.004986\r\n"
-> "x-transaction: 0099eb060040b4f8\r\n"
-> "x-xss-protection: 1; mode=block\r\n"
-> "\r\n"
reading 166 bytes...
-> ""
-> {"errors":[{"code":"UNAUTHORIZED_CLIENT_APPLICATION","message":"The client application making this request does not have access to this API"}],"request":{"params":{}}}read 166 bytes
Conn close

#6

Thanks, @Tianape. What I was looking for was: oauth_consumer_key and oauth_token, but they’ve been redacted. I just need to confirm that they’re the same in both requests to ensure you’re using the same app. If so, we can rule that out.

Can you also check whether you can create a Scheduled Tweet using the POST accounts/:account_id/scheduled_tweets endpoint?

Finally, can you share your app ID so we can look into that, too?

Thanks!


#7

The app ID: 8368540

I can confirm the tokens are the same for both requests. I authenticated twurl and then made both request in sequence. I did not re-authenticate in between. If you still want to confirm though, I can of course send the non-censored version or the responses to your Twitter account privately.

Please understand that I cannot really try creating a scheduled tweet as this is an active account and if anything goes wrong a test tweet will be sent incorrectly.

Thanks for your help!


#8

Thanks for the additional information, @Tianape!

I’ve found the issue and have submitted a patch. I’ll let you know once it’s deployed.

In terms of creating a Scheduled Tweet, in case it helps, these are nullcasted by default (nullcast=true)—i.e., they do not appear in the timeline.


#9

@Tianape: We’ve deployed a fix. Please let us know whether this issue has been resolved. Thanks.


#10

Thanks for the help @juanshishido! I can confirm it’s working now. :slight_smile: