I’m trying to post to twitter using the API, and I already have my 4 keys from my app and account. I can post simple messages (strings containing no special characters). When I try to post the following message: Maybe he’ll finally find his keys. #peterfalk, I get a 401 saying that it couldn’t authenticate me. I’ve been comparing to twitter4J and the oauthBaseString is the same:
POST&https%3A%2F%2Fapi.twitter.com%2F1.1%2Fstatuses%2Fupdate.json&include_entities%3Dtrue%26oauth_consumer_key%[mykey]%26oauth_nonce%3D3898605892584130366%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1501185867%26oauth_token%[mytoken]%26oauth_version%3D1.0%26status%3DMaybe%2520he%2527ll%2520finally%2520find%2520his%2520keys.%2520%2523peterfalk
Here is what my Authorization header looks like:
OAuth oauth_consumer_key=[mykey],oauth_nonce=3898605892584130366,oauth_signature_method=HMAC-SHA1,oauth_timestamp=1501185867,oauth_token=[mytoken],oauth_version=1.0,oauth_signature=I6AGkpSgiF90R8jf2C6vt5RfMgw%3D
and the Uri:
https://api.twitter.com/1.1/statuses/update.json?include_entities=true&status=Maybe%20he'll%20finally%20find%20his%20keys.%20%23peterfalk
Any thoughts on how I can correct this problem?
My code works if I have a simple message such as “HelloWorld”