guzzle / oauth-subscriber

Signs Guzzle requests using OAuth 1.0 (Guzzle 6+)
MIT License
241 stars 89 forks source link

Problem with signatures for query strings without values #65

Open spiasecki opened 6 years ago

spiasecki commented 6 years ago

What is the correct way to generate the signature for requests with query string that has no key=value just a string without "=" sign for example https://domain/path?querystring

The service im connecting with for urls like that returns invalid signature error. So who is not compliant with the RFC ? the service or the subscriber implementation ?

With one simple modification to the prepareParameters method i got the requests working, I can make a PR but i dont know it would be a valid change.

private function prepareParameters($data)
{
        // Parameters are sorted by name, using lexicographical byte value
        // ordering. Ref: Spec: 9.1.1 (1).
        uksort($data, 'strcmp');
        foreach ($data as $key => $value) {
            if ($value === null) {
//              unset($data[$key]); // current code
                $data[$key] = ""; // modification needed to make requests with a valid sig
            }
        }
        return $data;
}
michalv8 commented 6 years ago

I am also having this issue - I am using RQL queries to filter request results and oauth-subscriber is ignoring my query. In case of url like this http://example.com?eq(foo,bar) part eq(foo,bar) is ignored.