• I am not a coder, I am using chat GPT and dictating outcomes and it writes code to produce my needs.

    Right now I am going through hell with REST and Application passwords.

    I have had the hosting provider whitelist everything on their end, and if I use my user password I get results but if I used the application password I get this:

    {

        “status”: “error”,

        “error”: “INVALID_PASSWORD”,

        “code”: “400”,

        “error_description”: “Incorrect password.”

    }

    I literally copy paste the password. I have no idea what to do, please help

    • This topic was modified 3 months, 1 week ago by brettjina.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The feedback is clear. The password is incorrect. Without knowing what you have entered, it is not even possible to guess what the reason might be (except that the password is incorrect). I would recommend you take a look at the manual or this article here rather than relying on AI answers: https://make.www.ads-software.com/core/2020/11/05/application-passwords-integration-guide/

    Thread Starter brettjina

    (@brettjina)

    I am copy pasting the password though.

    I am encountering an issue with using Application Passwords for REST API integration on a WordPress site hosted with Afrihost. My goal is to programmatically create and publish posts using the REST API, but Basic Authentication seems to be causing conflicts with Application Passwords.

    Current Setup and Attempts

    1. Environment Details:
      • WordPress version: 5.6+
      • Hosted on Afrihost with SSL enabled.
      • Application Passwords are enabled and generated for the user.
    2. The Problem:
      • REST API requests using Basic Authentication with Application Passwords consistently return:jsonCopy code{"status":"error","error":"INVALID_PASSWORD","code":"400","error_description":"Incorrect password."}
      • Using cURL:bashCopy codecurl --user "username:application_password" https://example.com/wp-json/wp/v2/posts -d '{"title":"Test Post"}' -H "Content-Type: application/json" Response:vbnetCopy codecurl: (35) schannel: next InitializeSecurityContext failed: CRYPT_E_NO_REVOCATION_CHECK (0x80092012)
      • Using Python scripts and REST clients yields similar errors, either 401 Unauthorized or 400 INVALID_PASSWORD.
    3. Steps Taken:
      • Verified Application Passwords:
        • Generated multiple Application Passwords for the user.
        • Confirmed the passwords were copied correctly without spaces.
      • ModSecurity:
        • Initially blocked requests but has since been whitelisted by the hosting provider.
      • Basic Authentication Conflict:
        • Suspected conflict due to staging environment protections using Basic Auth.
        • Tested adding headers and removing site-level authentication to no avail.
    4. Error Analysis:
      • Based on WordPress Trac Ticket #51939, there seems to be a known conflict where Application Passwords fail when Basic Auth is enabled at the server level.

    What I’ve Tried

    1. Testing Alternative Headers:
      • Tried sending requests with Authorization: WP-App-Password headers instead of Basic.
      • Result: No change in behavior.
    2. Added Custom Filters:
      • Added filters such as wp_is_application_passwords_available to explicitly enable Application Passwords.
      • Result: No improvement.
    3. Using a Plugin:
      • Installed a custom REST API plugin to manage authentication flow, but the conflict persists.

    Questions for the Community

    1. Is there a recommended workaround to bypass the Basic Auth conflict with Application Passwords, specifically for staging environments?
    2. Can Application Passwords be used alongside Basic Auth with any custom filters or headers?
    3. Are there alternative authentication methods (e.g., OAuth) that work better in such cases?

    Any guidance or suggestions would be greatly appreciated. I’m happy to provide additional details or logs if needed.

    Thank you in advance for your help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.