Hello all.
Completly new to OAuth.

I have implemented a class in Java with this method
string signature = Signature.calculateRFC2104HMAC(data, key);

I tried Signature,calculateRFC2104HMAC ([consumerkey], [secrete key])
But still geting 401 status code when u call request token.

What i have no clue is what should i set in data and key parameters.

I would apretiate any help.

Thank you very much.


Data is the signature base string. Key is the signing key, composed of the consumer secret and token secret.

Obtaining both of these values is described here:

My advice would be that unless you’re willing to put up with a lot of frustration until you get your signing completely correct, you should use a third party oauth library. Twitter4j happens to be excellent:


Hi. Thanks for your response @kurrik

I am still geting 401 status code.

This is the base string of a tipical request: POST&

This is the “Authorization:” header i am sending.

Any idea


PS: Of course the method is POST. Actually not sending anything in the content.


By the way… I am trying to get it correct but also following your advice.


Your signature is not percent encoded. Make sure you follow the steps at the bottom of precisely.


Hi @kurrik I figured out Twitter4J and seems to work fine. I think thats the path i will take :slight_smile:

Thanks for your support.