OAuth1 icon indicating copy to clipboard operation
OAuth1 copied to clipboard

Media upload with OAuth1

Open aliazlan4 opened this issue 8 years ago • 1 comments

Does OAuth1 supports media endpoint too? When I send image content in "contents" parameter in body along with other OAuth1 parameter like token and signature etc then these parameters also concatenate with image content in image file which corrupts image file. Kindly let me know how to upload image file to Wordpress Api with OAuth1 with guzzle.

aliazlan4 avatar Oct 04 '17 20:10 aliazlan4

Have a look at how this works.

https://gist.github.com/kosso/71c957e30a40116e5f98

Particularly line 319 for my oauthRequest() function and the _http() one below it. See how it detects if it's a file or not (L448) and sets the headers differently. : https://gist.github.com/kosso/71c957e30a40116e5f98#file-wp_api_oauth_test_client-php-L319

Hope this helps. It's been working for a long time.

kosso avatar Oct 04 '17 21:10 kosso