WP-API / OAuth1

OAuth server implementation for WP API

Home Page:http://oauth1.wp-api.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Media upload with OAuth1

aliazlan4 opened this issue · 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.

commented

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.