Support » Developing with WordPress » Creating Users via REST API

  • Resolved bohdanwlcm

    (@bohdanwlcm)


    Hey community,
    I’m trying to make it possible to create users via REST API using Basic auth.
    But I’m getting this error:

    {
        "code": "rest_cannot_create_user",
        "message": "Sorry, you are not allowed to create new users.",
        "data": {
            "status": 401
        }
    }

    My account has the Admin role.
    What should I do to make it possible to add users via REST API?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    You need a proper authentication to be able to update the DB. Unless you’re using the default cookie auth, your WP role is not a factor. Useful auth plugins are listed near the bottom of the linked page, including Basic Auth.

    Application Passwords is another alternative, it’s no longer a plugin, it had been incorporated into WP core. Despite what I said earlier, it’s indirectly related to your WP role, or rather the role that created the password. FWIW, this is my go-to choice for authorization.

    Thread Starter bohdanwlcm

    (@bohdanwlcm)

    Thanks!

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