http://qs321.pair.com?node_id=1123678


in reply to Net::OAuth and POST data

https://metacpan.org/source/SIMONW/Net-OAuth-Simple-1.5/lib/Net/OAuth/Simple.pm does both a ->sign and a ->verify on a request

Replies are listed 'Best First'.
Re^2: Net::OAuth and POST data
by gryphon (Abbot) on Apr 17, 2015 at 16:03 UTC

    Greetings,

    So what? Neither Net::OAuth nor Net::OAuth::Simple include POSTDATA in the signing process, as far as I can tell. They include "extra params", but these have to be key/value pairs, not POSTDATA. Ergo, I can't see a way to issue a standard HTTP POST request that's OAuth signed using either module. If I'm wrong, I would love to be proven so with a POSTDATA-signed code sample.

      Greetings, So what? Neither Net::OAuth nor Net::OAuth::Simple include POSTDATA in the signing process, as far as I can tell.

      Well, https://metacpan.org/source/SIMONW/Net-OAuth-Simple-1.5/examples/twitter appears like it would work, like the author used it and tested it

      So the way Net::OAuth::Simple does things doesn't match the way you try to do it

      Is it supposed to sign POSTDATA? I don't know, but I do know there is stuff in your code that doesn't make sense, and doesn't do anything, see

      do you see that? before/after is no change in the object

      Also, if you try to ->sign just like ::Simple you get an error  Can't locate object method "$content" via package "Net::OAuth::ProtectedResourceRequest" at Net/OAuth/Message.pm line 162.

      update: removing  $oauth->signature_elements( [ @{ $oauth->signature_elements }, $content ] ); no death, and apparently POSTDATA is taken into account somehow (signature is different)

      So what next? I dont know :)