Could not authenticate with OAuth error when passing parameters


#1

Hi,

I am getting “Could not authenticate with OAuth” error when i pass parameters to the API. if i don’t pass any parameter then it works fine.

Could you please look into this issue and provide me the solution.

My OAuth request array is as below:

Array
(
    [method] => GET
    [uri] => Array
        (
            [host] => api.twitter.com
            [path] => 1/direct_messages.json
        )

    [auth] => Array
        (
            [method] => OAuth
            [oauth_token] => 605267577-YwEtkLXgDZcXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
            [oauth_token_secret] => p2SKUjaRz7oUqW8jmXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
            [oauth_consumer_key] => PAu4LlcETXXXXXXXXXXXXX
            [oauth_consumer_secret] => OA2ISmIYMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
        )

    [body] => Array
        (
            [count] => 200
        )
     [header] => Array
     (
        [Authorization] => OAuth oauth_version="1.0",oauth_signature_method="HMAC-SHA1",oauth_token="605267577-YwEtkLXgDZcLaFIZHdJxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",oauth_consumer_key="PAu4LlcETSxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",oauth_nonce="616caa42455f6a490f7fce089fdb56b5",oauth_timestamp="1342592116",oauth_signature="B2Dr4CioXL55fwxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
      )

)

i passed the “count” parameter and this is response that i got

Array
(
    [error] => Could not authenticate with OAuth.
    [request] => /1/direct_messages.json
)

Thanks in advance,
Ashish


#2

You need to pass the query string in the signature otherwise it won’t work.