Hi Brad,
I'm sure that's correct, but:
* When I just sign the OAuth params (no content type, no POST fields), I get "The authorization headers in your request are not valid: Invalid signature" * When I then add the content-type to the header, I get ... the API help page, wrapped in the XML tag <error code="help" info="" xml:space="preserve"> (even though I am querying JSON...)
Apologies if this gets too detailed for the mailing list, it's just very frustrating :-(
On Wed, Mar 19, 2014 at 5:25 PM, Brad Jorsch (Anomie) <bjorsch@wikimedia.org
wrote:
On Wed, Mar 19, 2014 at 12:07 PM, Magnus Manske < magnusmanske@googlemail.com
wrote:
Is there any example code for uploading local files to Commons via OAuth? A trick I can't find? Anything?
The trick is that you only include the POST data in the signature when the content-type is application/x-www-form-urlencoded. Uploads require multipart/form-data, so you don't include any of the posted fields when calculating the signature (i.e. pretend it's an empty POST when signing).
-- Brad Jorsch (Anomie) Software Engineer Wikimedia Foundation _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l