I have a problem when trying to create users with authentication via plugin: "application passwords"

curl -X POST --user "applogin:y530 8Uf9 OMSW sSsR Q0S8 zaqS" "http://website.com//wp-json/wp/v2/users" -d "username=TestUser&password=A1b2c3d4&email=mail@mail.com" -H "Content-Type: application/x-www-form-urlencoded" 

return errror: "Sorry, you are not allowed to create new users"

What could this be caused by? On the local instance it worked

  • 1
    How are you authenticating the request? Nov 30, 2021 at 12:43
  • 1
    Did you see the message at that link that you shouldn’t use the plugin because the feature is now included? Nov 30, 2021 at 13:36
  • You should check that the same user is set up on the remote instance, that application passwords are enabled on the remote instance, that that's a valid application password for the remote instance not the local one, and that the user has the create_users permission. If that all looks OK you should try and test that the authentication is actually working on the remote endpoint - I'm not sure what to suggest, there's no "get me" endpoint like many APIs I don't think - or e.g. add some trace to create_item_permissions_check() in WP_REST_Users_Controller to trace out who it thinks you are.
    – Rup
    Nov 30, 2021 at 13:42
  • I'm not sure what you mean by diabetic APIs? You're not using cookie-based authentication so you shouldn't need a nonce header.
    – Rup
    Nov 30, 2021 at 15:00


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.