Volley OAuth1.0 Authentication

I am trying to use OAuth1.0 authentication. I try this on the postman. The Postman's Guide says that you can set the following values:

Consumer Key: RKCGzna7bv9YD57c

Consumer Secret: D + EdQ-gs $ -% @ 2Nu7

In postman, I set these values ​​and check "Add options 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_signature_sign3 ", oauth_version =" 1.0signature ", oauth_version =" 1.0signature "

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 the assignment of the consumer key and the consumer secret will be sufficient according to the postman .

Below usage doesn't work. It says that {"status":"fail","message":"Timestamp is missing or is not a number"}

. Shoud I'm using headers.put("Authorization", authString);

?

Also need to specify the time stamping, 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");

      

+3


source to share





All Articles