Diego Esteban Osorio Zaldivia
Posts: 0
Joined: Thu Jul 25, 2013 10:18 pm

401 Unauthorized error when trying to get mentions on twitter

Hello dear!

Do you know if there is any difference between the authorization header used to send a tweet on twitter (https://dev.twitter.com/docs/api/1.1/...) and the authorization header used to read the mentions, the user timeline or see a user data?

I am based on twitter tutorials you have, in which use GET and Application-only authentication to search tweets (Building twitter search app) and POST and Application-user authentication to post tweets (Building a Twitter App to Send Tweets) .

If you notice, I'm trying to run resources Twitter API using GET and Application-user authentication, so I'm generating the authorization parameter in the same way that you did in "Building a Twitter App to Send Tweets" and I'm running GET service with the URL https://api.twitter.com/1.1/statuses/.... But, I'm having 401 Unauthorized error and I have not been able to fix.

The public link to my application is here.

I'm forgetting some detail? Any idea?

Thanks in advance,

Oleg Danchenkov
Posts: 0
Joined: Tue Apr 30, 2013 5:51 pm

401 Unauthorized error when trying to get mentions on twitter

Hi, Diego.
1) You don't map "count" to "Authorization" in GetMentionsDS service, but you should.
2) Check this https://dev.twitter.com/discussions/1...
I think you have problem with prefix when building the authentication header. You use leading "POST&". See TwitterSendJS.js row
codesignBaseString = 'POST&' + this.encodeSymbols(apiUrl) + '&' + this.encodeSymbols(signBaseString);/code
but you should use "GET&" for requests with method GET

Diego Esteban Osorio Zaldivia
Posts: 0
Joined: Thu Jul 25, 2013 10:18 pm

401 Unauthorized error when trying to get mentions on twitter

thanks so much! I had not noticed that detail and now I check it!

Matt6607699
Posts: 0
Joined: Sat Jan 25, 2014 7:18 am

401 Unauthorized error when trying to get mentions on twitter

Hi, I have been stuck with this 401 error: {"errors":[{"message":"Could not authenticate you","code":32}]}
for days now and for the life of me can't figure out whats wrong. I have followed this tutorial:
http://docs.appery.io/tutorials/build...
My intent of using this is just to use the login(from the login page)to Authenticate a user before creating an entry in my database for them. After they login they will use the appery session token. SendService will eventually be replaced by a GET request to gather user profile data for db.
I am able to get the user routed to twitter login and login pin given. When entered, the Request token and access token are granted but the TwitterSend_SendService gets an error every time without the debugger telling me why. Any Ideas?

I noticed that the twitter user_ID is appended to the beginning of the oauth_token for this POST, is that normal?

public link:
http://appery.io/app/view/dcb8e8fb-c7...

Thank you for any help you can provide.

Return to “Issues”