This comment has been minimized.

samrat: I looked at the code you linked to and it's different from what you've posted in your comment. In the linked code, you are sending in the file contents in your call to oath.client/credentials, and you shouldn't do that. Only the oauth parameters should be used to create the signature.

Please let us know which copy of the code you're using. Also, it can be useful to capture and inspect the request with your HTTP library or even Wireshark.

samrat: I looked at the code you linked to and it's different from what you've posted in your comment. In the linked code, you are sending in the file contents in your call to oath.client/credentials, and you shouldn't do that. Only the oauth parameters should be used to create the signature.

Please let us know which copy of the code you're using. Also, it can be useful to capture and inspect the request with your HTTP library or even Wireshark.