Coder Social home page Coder Social logo

Comments (8)

Boyquotes avatar Boyquotes commented on June 15, 2024

Hi,

Same problem here...but no solution

Nicolas

from wp-api.

rmccue avatar rmccue commented on June 15, 2024

Using Basic authentication (--user user:pass) should work, at least until #37 is completed.

Could this be related to #8? Are you running PHP in CGI mode?

from wp-api.

Boyquotes avatar Boyquotes commented on June 15, 2024

Thanks for your reply.

  • Completely #8, if I test in a php file on the root, the server variables $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'] are correct, but these variables are empty in WP-API/lib/class-wp-json-posts.php file.
  • Yes I use CGI/FastCGI on my server, this is the problem?

In #37, I don't understand:
"Basic authentication can be removed and/or moved to a separate plugin to help development"
Removed or moved? and where is this plugin if moved.
We must not use Basic authentification, only Oauth, that it?

Otherwise : in official documentation ( https://github.com/WP-API/WP-API/blob/master/docs/guides/getting-started.md)
In my bash command line, curl have not --data-binary option also -d or --data and use like this:
curl -d "@updated-post.json"

Have a nice day.

from wp-api.

landwire avatar landwire commented on June 15, 2024

Yes,
I do have CGI support switched on. No idea what it is or if I should turn it off. Any advice with regards to this would be helpful. Though I run PHP support as the Apache Module. Does that make sense?

Copy and paste from my setup:

  1. PHP support (Run PHP as APACHE , PHP version 5.4.21 )
    Note that switching the PHP handler type may break functionality of existing PHP scripts on this website.
    Learn how to choose the most suitable PHP settings
  2. CGI support (cgi-bin directory is located in the root directory of webspace ) is enabled
    S

from wp-api.

Boyquotes avatar Boyquotes commented on June 15, 2024

I have installed this plugin:
WP BASIC Auth

And the basic auth is not dropped now and curl command work fine ;)

Why this information isn't in documentation?

Thanks.

from wp-api.

landwire avatar landwire commented on June 15, 2024

Hello Boyquotes,
ok, my curl works now! Thank you for that hint with the plugin! Now I only would like to it working with the JS code. Basically how can I write this:
curl --data '{"title": "Hello Updated World!"}'
-H "Content-Type: application/javascript"
--user username:password
http://apitest.landwire.net/wordpress/wp-json.php/posts/1

Instead in Javascript? I tried the code above in my initial question, but I must be doing something wrong I assume. Maybe some syntax? Any help is highly appreciated!

from wp-api.

rmccue avatar rmccue commented on June 15, 2024

Closing as duplicate of #8.

Not sure what else we can do here, but thanks for the heads up that there's a plugin that fixes this for you. We'll look into implementing their workaround into WP-API :)

from wp-api.

fransiskapw avatar fransiskapw commented on June 15, 2024

hi, i still get 400 bad request using AJAX. I already installed WP Basic Auth. Any suggestion? Thanks

from wp-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.