Support » Plugin: WP Broadbean » POST to endpoint fails with 401 Unauthorized

  • Hi, I’ve just installed the plugin (on a staging site hosted at WPEngine) and I’m getting a 401 Unauthorized error when trying to POST to the endpoint URL. I’m using a copy of the example XML so I know the syntax is correct. I’ve already asked WPEngine about the issue and there is nothing they can see in their logs, saying it must be a problem with the plugin. They can confirm SimpleXML is enabled as you can see yourself in phpinfo: http://oceaniahealth.staging.wpengine.com/phpinfo.php

    Of course I’ve double-checked that the username and password used in the XML matches the plugin settings, so not sure why it would say username or password is incorrect? Is this plugin compatible with php 7.3 or 7.4? Any other ideas what is wrong?

    Here’s the error:

    HTTP/1.1 401 Unauthorized
    Server=nginx
    Date=Wed, 15 Apr 2020 22:19:30 GMT
    Content-Type=text/html; charset=UTF-8
    Content-Length=647
    Connection=keep-alive
    Keep-Alive=timeout=20
    Link=<http://oceaniahealth.staging.wpengine.com/wp-json/&gt;; rel=”https://api.w.org/&#8221;
    X-Powered-By=WP Engine

    <br />
    <b>Warning</b>: simplexml_load_string(): Entity: line 24: parser error : Extra content at the end of the document in <b>/nas/content/staging/oceaniahealth/wp-content/plugins/wpbroadbean/templates/inbox.php</b> on line <b>28</b><br />
    <br />
    <b>Warning</b>: simplexml_load_string(): <job> in <b>/nas/content/staging/oceaniahealth/wp-content/plugins/wpbroadbean/templates/inbox.php</b> on line <b>28</b><br />
    <br />
    <b>Warning</b>: simplexml_load_string(): ^ in <b>/nas/content/staging/oceaniahealth/wp-content/plugins/wpbroadbean/templates/inbox.php</b> on line <b>28</b><br />
    Authorisation failed. Incorrect username or password.
    Don’t show this window on launch

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mark Wilkinson

    (@wpmarkuk)

    Hi there. Best guess here is that your XML is not formatted correctly as that is where the error is thrown. Double check you don’t have whitespace at the end of it for example.

    Thread Starter aleklisefski

    (@aleklisefski)

    Yes, I have checked for a white space — there’s nothing. It’s nearly identical to the sample XML file you provide with the plugin. With just a couple small edits to username, password, etc. Anything else you can think of?

    Plugin Author Mark Wilkinson

    (@wpmarkuk)

    I have just tested this on my local install of WordPress 5.4 running PHP 7.4.2, by copying and pasting the sample XML and it works fine.

    The point where it is failing for you is the simplexml_load_string() function. I suspect this is returning false which means that the username and password check are not working and hence the error.

    To be honest I could do with adding a better check for whether the simplexml_load_string() returns a valid result and throw and appropriate error. I will add this to the roadmap.

    Can you paste the XML you are using here? Are you using something like Postman to test it with?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘POST to endpoint fails with 401 Unauthorized’ is closed to new replies.