401 Unauthorized error with Tweet URLs



I am developing a client application (website) which will post to Twitter on behalf of the user. But I have unfortunately run into a bit of a snag with posting Tweets that have URLs in the text. I can post plain text Tweets with out any issue, but the minute I add a parameterized URL I get a 401 unauthorized response.

So for example this Tweet would work:

We have updated our business profile! http://localhost:8005/directory/directory.cfm

But this Tweek gives a 401:

We have updated our business profile! http://localhost:8005/directory/directory.cfm?BusinessID=8

Here’s the technical details:

Windows Server 2008
IIS 7.5
Coldfusion 9

oauth_consumer_key: kmdP6acaOerqxqHUNyyBOg
oauth_nonce: MTMxODk1Njg5MA==
oauth_signature_method: HMAC-SHA1
oauth_timestamp: 1318871942
oauth_token: 284729225-ke0qzExyvr55JTrv0AstJ7LPzwbTBNoNenKu0R4b
oauth_version: 1.0
status: We’ve updated our directory information! http://localhost:8001/directory/directory.cfm?businessID=1

Base OAuth Signature String


Composite Key


OAuth Header

OAuth oauth_consumer_key="kmdP6acaOerqxqHUNyyBOg", oauth_nonce="MTMxODk1Njg5MA%3D%3D", oauth_signature="4oWnyke0%2BMUn9zTb5NOsnkea0GY%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1318871942", oauth_token="284729225-ke0qzExyvr55JTrv0AstJ7LPzwbTBNoNenKu0R4b", oauth_version="1.0"

Do I need to do some sort of extra formatting with the parameterized URLs? Or something?


It looks like the Base OAuth Signature string is getting cut off but you can Inspect or View Source to get all of it.


Just a quick heads up that you included your consumer secret in this post (in the composite key field you provided) – I’ve edited your post to disinclude this, but you may want to regenerate your API key & secret as a result. More on your issue here later…


Thanks! I actually purposely left it in there for testing purposes. I had planned on resetting everything once I got it working =D.


Hello. I’m revisiting this issue as it’s still open on the project, do you have any new information in regards to the issue?


Hi @Aeosis,

Looking at the signature base string in the example you posted, this looks mostly right. Have you considered generating “golden examples” using the OAuth Tool available when navigating to your app on this site? If you provide it the various parameters you’re trying to use for this POST, it will show you the correct signature base string and authorization header to validly make the request, which you can then work to replicate in your own code.

The signature base string you show expects that the exact value for the status parameter you’re passing will be:


When you submit the POST body are you escaping it or are you leaving it unescaped?


Hi Taylor,

I look a look at the OAuth Tool in my app settings and compared the result to the one I generate using my program

OAuth Tool


Signature: MVPibRlsrDGTG3%2FXltpqgNznUBI%3D

Generated by my code:


Signature: RP1U4AnBZ8amYCxT2PGsLywIYZo%3D

I split the two up and compared them. The only differences between the two are the oauth_nonce and oauth_timestamp (which are understandable). At the moment I’m a bit lost as to what the problem could be.


This not work?


Yea it still didn’t work. But I swapped out my general purpose OAuth library for Coldfusion Twitter specific library and it seemed to handle the posting no problem. Although I would have preferred using a general OAuth library I unfortunately needed to complete the task =/