Response code: 401 for post request of twitter rest api


#1

Hi,

I registered my application over twitter and generate the following keys

Consumer_key
consumer_secret_key
access_token
access_token_secret

access level :- Read and write

With the help of above keys i am able to GET request for

homeline
friends
mentions
followrs
etc…

BUT when i am posting a tweet from my application, i got the 401 server response code. I don’t know what i am missing, if anyone face the same problem please let me know.

Thanks,
Deepak


#2

Are you able to make a request to https://api.twitter.com/1/account/verify_credentials.json with those same credentials? If so, that means your OAuth signing is correct for GETs – if not, that means your GETs have probably been being evaluated in an unauthenticated context – which means something isn’t quite right with your signing or your keys.

If the call to account/verify_credentials does work then you should examine the way your OAuth encodes the parameters you are sending – also make sure that the POST body you’re sending has those parameters properly escaped.