I try to use OAuth1.0 authentication. I try it on postman. Postman guide says that you can set the following values:
Consumer Key: RKCGzna7bv9YD57c
Consumer Secret: D+EdQ-gs$-%@2Nu7
On postman I set these values and check "Add params to header". The response status code is 200.
When I click add params to header, postman generates below value:
OAuth oauth_consumer_key="RKCGzna7bv9YD57c",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1499874836",oauth_nonce="T5zV4W",oauth_version="1.0",oauth_signature="YDXruS98dvqQs7Ra3a3ZWczkEpM%3D"
public Map<String, String> getHeaders() throws AuthFailureError {
final Map<String, String> headers = new HashMap<>();
headers.put("Authorization", headerValue); // headerValue is taken from postman
return headers;
}
It works. But I expect that assigning consumer key and consumer secret is enough according to postman guide.
Below usage doesn't work. It says that {"status":"fail","message":"Timestamp is missing or is not a number"}.
Shoud I use headers.put("Authorization", authString);?
Also must I give timestamp, signature and signature method?
headers.put("oauth_consumer_key","RKCGzna7bv9YD57c");
headers.put("oauth_signature_method","HMAC-SHA1");
headers.put("oauth_timestamp","1499874836");
headers.put("oauth_nonce", "0Jx39O");
headers.put("oauth_signature_method","HMAC-SHA1");
headers.put("oauth_signature", "GGKc%2FuFoAWIflEsfE1%2B6mZau3vM%3D");
headers.put("oauth_timestamp","1499872116");
headers.put("oauth_version","1.0");