Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Media upload with OAuth1 #212

Open
aliazlan4 opened this issue Oct 4, 2017 · 1 comment
Open

Media upload with OAuth1 #212

aliazlan4 opened this issue Oct 4, 2017 · 1 comment

Comments

@aliazlan4
Copy link

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.

@kosso
Copy link
Contributor

kosso commented Oct 4, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants