monkehTweets icon indicating copy to clipboard operation
monkehTweets copied to clipboard

Unable to post status update with a message containing exclamation mark

Open boughtonp opened this issue 10 years ago • 24 comments

Posting "test message" works, but posting "test message!" results in:

{"errors":[{"message":"Could not authenticate you","code":32}]} 

Updated to latest code from GitHub master branch and it does the same thing.

Most of the results on the web suggest this is an encoding problem (it's not just exclamation mark that is affected, comma and other characters are too), but dumping the arguments to httpOAuthCall it looks like the URL is encoded, so not sure that's it.

Other search results suggest the request needs to be sent as "application/x-www-form-urlencoded" - the cfhttp is currently set to multipart (i.e. multipart/form-data), however if I turn multipart off it doesn't work at all (i.e. both "test" and "test!" fail with code 32).

Using the Twitter OAuth Tool, sending "test message!" is working (via curl) - but changing the status after generating the signing results will fail with code 32, so I'm guessing the status text is used to generate the nonce/signature (since they change on each request), but I can't see any obvious place in the monkehTweets code where this happens?

Any thoughts?

boughtonp avatar Dec 15 '14 18:12 boughtonp

Saw the same issue today when you try to post a tweet that contains !! on it.

enniob avatar Apr 09 '15 21:04 enniob

Thank you, I'll look into this ASAP.

coldfumonkeh avatar Apr 10 '15 07:04 coldfumonkeh

Still haven't had a chance to look into this yet (conference season) but will do ASAP

coldfumonkeh avatar Apr 16 '15 14:04 coldfumonkeh

Just ran some xUnit AND manual tests and it worked for me (I hate saying that).

See https://twitter.com/randomUser1000/status/589090661992898560 and https://twitter.com/randomUser1000/status/589090660344541186.

These were both sent using an instantiated monkehTweet object with the consumerKey, consumerSecret , oauthToken, oauthTokenSecret and userAccountName values provided for authentication.

I received no issues or status number responses that failed the tests. This is using the latest version of the library from the repository.

Can you try again and if you're getting the same results let me know how and what you're doing?

coldfumonkeh avatar Apr 17 '15 15:04 coldfumonkeh

Sorry for the delay, I pulled again from the github and it worked. Maybe something was wrong with the files I had.

Thanks for checking it out.

enniob avatar Apr 29 '15 12:04 enniob

Pulled fresh files from github today and get this issue as well - any thoughts how to resolve?

itstrace avatar Sep 03 '15 15:09 itstrace

I think it's a version issue with the API or something not being sent in the headers for any request other than a traditional GET. Others using various other language frameworks and wrappers have experienced the same issue. I will have a look over the next few days to resolve.

coldfumonkeh avatar Sep 03 '15 15:09 coldfumonkeh

In addition to !, for me it happens with (, ), and *.

RosemaryONeill avatar Sep 16 '15 20:09 RosemaryONeill

Unable to replicate. Closing.

coldfumonkeh avatar Nov 12 '16 15:11 coldfumonkeh

Hello Matt,

I happened to use the library today and it seems that the issue persists. I tested it with ! and * but it could be other non-alphanumeric characters too.

Just to make sure that I did not do anything wrong, I tried posting with only alphanumeric characters and it worked fine, so it seems that I am not doing anything else wrong there that could cause the issue (but who knows?).

I tried contacting you via the IRC channel but I didn't find you online at that time. If you could join that IRC channel at some point during the day, I could show you a test case to help debugging the issue and solving it once and for all :)

Thank you!

MichaelMassalas avatar Feb 13 '17 09:02 MichaelMassalas

Hi @MichaelMassalas

Apologies for the late reply. I'm on IRC now (havent logged in for a while), and will have a look at the issue. Thank you for raising it again.

coldfumonkeh avatar Feb 17 '17 07:02 coldfumonkeh

Hi @coldfumonkeh

Thank you for your reply. Is there any progress with regards to the issue? I will try to stay logged in to IRC as long as I can, so if you see me online, ping me.

Thank you again.

MichaelMassalas avatar Feb 24 '17 11:02 MichaelMassalas

Hi @coldfumonkeh

I was wondering if there is any update on this issue. I am planning to integrate all my systems with Twitter in the near future and I would really love to use this framework.

I would appreciate any response so that I know whether fixing this any time soon is feasible or not.

Thank you!

MichaelMassalas avatar Apr 07 '17 08:04 MichaelMassalas

I would also be interested in any update on this.

Thank you.

Rosemary

From: MichaelMassalas [mailto:[email protected]] Sent: Friday, February 24, 2017 6:43 AM To: coldfumonkeh/monkehTweets Cc: RosemaryONeill; Comment Subject: Re: [coldfumonkeh/monkehTweets] Unable to post status update with a message containing exclamation mark (#21)

Hi @coldfumonkeh https://github.com/coldfumonkeh

Thank you for your reply. Is there any progress with regards to the issue? I will try to stay logged in to IRC as long as I can, so if you see me online, ping me.

Thank you again.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/coldfumonkeh/monkehTweets/issues/21#issuecomment-282272391 , or mute the thread https://github.com/notifications/unsubscribe-auth/AEEaL1SVg1CcxGQO3pCCNMdD9vcpKy1zks5rfsJGgaJpZM4DIksH . https://github.com/notifications/beacon/AEEaL1okisdXFQYGiEPdYL03ALaOMPbaks5rfsJGgaJpZM4DIksH.gif

RosemaryONeill avatar Apr 13 '17 17:04 RosemaryONeill

Hi @MichaelMassalas and @RosemaryONeill

I can't seem to replicate this issue. Unit tests I have with exclamation marks successfully post to Twitter. Can you send me a sample string of content you're having issues with? Many thanks

coldfumonkeh avatar Apr 13 '17 17:04 coldfumonkeh

Hi Matt,

It happens with the simplest text. If I add an exclamation point, parentheses, or asterisk to any sentence, Twitter returns code 32, 'could not authenticate you'. It works perfectly if I do not include any of these characters.

Even when I test it using your post.cfm template, Twitter returns an error if I keep the exclamation point in the message. Could it be something with my Twitter app?

Rosemary

On Thu, Apr 13, 2017 at 1:17 PM, Matt Gifford [email protected] wrote:

Hi @MichaelMassalas https://github.com/MichaelMassalas and @RosemaryONeill https://github.com/RosemaryONeill

I can't seem to replicate this issue. Unit tests I have with exclamation marks successfully post to Twitter. Can you send me a sample string of content you're having issues with? Many thanks

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/coldfumonkeh/monkehTweets/issues/21#issuecomment-293965308, or mute the thread https://github.com/notifications/unsubscribe-auth/AEEaLxaZ_S-jFeRQ0eYrViVLPGlpB47Kks5rvljHgaJpZM4DIksH .

RosemaryONeill avatar Apr 13 '17 17:04 RosemaryONeill

Thanks @RosemaryONeill. More testing to come..

coldfumonkeh avatar Apr 13 '17 17:04 coldfumonkeh

Thank you!

On Thu, Apr 13, 2017 at 1:41 PM, Matt Gifford [email protected] wrote:

Thanks @RosemaryONeill https://github.com/RosemaryONeill. More testing to come..

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/coldfumonkeh/monkehTweets/issues/21#issuecomment-293971305, or mute the thread https://github.com/notifications/unsubscribe-auth/AEEaL5ohUOYbNuf6EFaA7zFD45-FTLRAks5rvl5GgaJpZM4DIksH .

RosemaryONeill avatar Apr 13 '17 17:04 RosemaryONeill

There must be something wrong. I've just posted a test message from my random test account (the default message with exclamation mark) with no issues:

https://twitter.com/randomUser1000/status/852580554402914306

coldfumonkeh avatar Apr 13 '17 17:04 coldfumonkeh

The script I'm using that returns the error code 32 is below. To get it to work, I had to remove the exclamation point and the apostrophe. Here's my test twiitter account: https://twitter.com/rosemaryoneill.

Could it be a setting in my Twitter account rather than the Twitter app? Or is there perhaps something wrong with the way I installed monkehtweet?

Thanks for looking into this.

Rosemary

// We also need to set the values into the authentication class inside monkehTweets application.objMonkehTweet.setFinalAccessDetails( oauthToken = session['accessToken'], oauthTokenSecret = session['accessSecret'], userAccountName = session['screen_name'] );

// Let's make a test call. This will update the status of the authenticated user. // If you are using this for a number of users , you will need to set the details prior to each call // using the setFinalAccessDetails() method above.

// If you are using this purely for a single user, you can set all of the // authentication details in the init() constructor method when instantiating the application returnData = application.objMonkehTweet.postUpdate("I'm using the awesome ##monkehTweets ColdFusion library from @coldfumonkeh!");

On Thu, Apr 13, 2017 at 1:54 PM, Matt Gifford [email protected] wrote:

There must be something wrong. I've just posted a test message from my random test account (the default message with exclamation mark) with no issues:

https://twitter.com/randomUser1000/status/852580554402914306

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/coldfumonkeh/monkehTweets/issues/21#issuecomment-293974620, or mute the thread https://github.com/notifications/unsubscribe-auth/AEEaL10EVh7CyE12Q8y8D6zQ9t2nEaipks5rvmFUgaJpZM4DIksH .

RosemaryONeill avatar Apr 13 '17 18:04 RosemaryONeill

Which CFML engine and version are you using?

coldfumonkeh avatar Apr 13 '17 18:04 coldfumonkeh

From investigation, other people using other libraries have had the same issue with special characters which needed encoding for submission to the API, but monkehTweets does that out of the box. I tested to make sure and set a urlencode before sending the params through to the authentication request method, and got a tweet that was double-encoded, so I know it's working fine without it:

https://twitter.com/randomUser1000/status/852580211220779008

coldfumonkeh avatar Apr 13 '17 18:04 coldfumonkeh

I'm using Adobe CF 11.

On Thu, Apr 13, 2017 at 2:16 PM, Matt Gifford [email protected] wrote:

Which CFML engine and version are you using?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/coldfumonkeh/monkehTweets/issues/21#issuecomment-293980041, or mute the thread https://github.com/notifications/unsubscribe-auth/AEEaLyiBlG9XMQOO0vgn2tCuNZ5VGBsrks5rvmZygaJpZM4DIksH .

RosemaryONeill avatar Apr 13 '17 18:04 RosemaryONeill

I looked at the cfhttp tag that monkeyTweets constructs for status updates with and without an exclamation point, and you can see that the status message is definitely encoded and there's no difference between them. (I've redacted codes, removed the < and added hard returns for readability.)

FAILED TO AUTHENTICATE cfhttp url="https://api.twitter.com/1.1/statuses/update.json? checkheader=false& oauth_consumer_key=c...xxxxxx...G& oauth_nonce=7...xxxxxx...B& oauth_signature=t...xxxxxx...D& oauth_signature_method=HMAC-SHA1& oauth_timestamp=1492091164& oauth_token=2...xxxxxx...j& oauth_version=1.0& status=special%20characters%21& timeout=30& trim_user=false" method="POST" result="returnStruct" multipart="true" timeout="30" cfhttpparam type="formfield" name="Authorization" value=""Authorization: OAuth realm="",oauth_version="1.0",oauth_nonce="7...xxxxxx...B",oauth_token="2...xxxxxx...j",oauth_consumer_key="c...xxxxxx...G",oauth_timestamp="1492091164",oauth_signature_method="HMAC-SHA1",oauth_signature="t...xxxxxx...D"" cfhttp

AUTHENTICATED cfhttp url="https://api.twitter.com/1.1/statuses/update.json? checkheader=false& oauth_consumer_key=c...xxxxxx...G& oauth_nonce=0...xxxxxx...C& oauth_signature=7...xxxxxx...D& oauth_signature_method=HMAC-SHA1& oauth_timestamp=1492090609& oauth_token=2...xxxxxx...j& oauth_version=1.0& status=Testing%20twitter%20code& timeout=30& trim_user=false" method="POST" result="returnStruct" multipart="true" timeout="30" cfhttpparam type="formfield" name="Authorization" value=""Authorization: OAuth realm="",oauth_version="1.0",oauth_nonce="0...xxxxxx...C",oauth_token="2...xxxxxx...j",oauth_consumer_key="c...xxxxxx...G",oauth_timestamp="1492090609",oauth_signature_method="HMAC-SHA1",oauth_signature="7...xxxxxx...D"" cfhttp

On Thu, Apr 13, 2017 at 2:20 PM, Matt Gifford [email protected] wrote:

From investigation, other people using other libraries have had the same issue with special characters which needed encoding for submission to the API, but monkehTweets does that out of the box. I tested to make sure and set a urlencode before sending the params through to the authentication request method, and got a tweet that was double-encoded, so I know it's working fine without it:

https://twitter.com/randomUser1000/status/852580211220779008

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/coldfumonkeh/monkehTweets/issues/21#issuecomment-293981131, or mute the thread https://github.com/notifications/unsubscribe-auth/AEEaL17GJrD4YKFCoaEWOjrCbNDvlukkks5rvmdzgaJpZM4DIksH .

RosemaryONeill avatar Apr 13 '17 18:04 RosemaryONeill