Authenticating My app

oauth

#1

Throws Error
{
errors: [1]
0: {
code: "UNAUTHORIZED_ACCESS"
message: “This request is not properly authenticated”
}-

request: {
params: {}
}-
}
What was the issue, is authentication ? How to authenticate my app (it has all settings and keys). I have all permissions for the account, also added call back url. The goal is, need to create campaigns and post ad, what to be done for this.


#2

@clplabs the error message you’re seeing indicates that the OAuth request is not being constructed correctly.

I recommend making a thorough read through the following guides:

https://dev.twitter.com/ads/campaigns/getting-started
https://dev.twitter.com/ads/campaigns/obtaining-ads-account-access
https://dev.twitter.com/oauth/3-legged

I also highly recommend the use of twurl for testing / validating and also as a reference implementation to follow. You can pass the --trace flag to see the raw request it’s making. This is good to have setup anyway since we often ask developers to use this when trying to reproduce an issue.


#3

I have tried to construct OAuth and provided consumer key and secret. The twurl returns a link which i pasted in browser and it shows an page with a button to authorize app with user name and password which re-directs to a page with a message “You’ve granted access to clptarget!” and provides a PIN. Now i pasted the PIN in twurl and it was successful and returns “Authorization successful”.
I accessed the url as per the twurl document (twurl /1.1/statuses/home_timeline.json), got some value and provided the command “twurl accounts”. Finally used “twurl accounts/MY_ACCOUNT_ID/campaigns” which shows message as in the image.
What i should i do now to view my created campaigns list or to create campaign, even the post campaign not worked. Am i doing anything wrong, need an immediate solution.

Note the same was done using twitter referred java library (scribe and hbc) which throws same things as above.


#4

@clplabs try this:

twurl -H ads-api.twitter.com "/0/accounts/[ACCOUNT ID]]/campaigns"

The twurl tool will default to the host api.twitter.com unless you specify otherwise.