Basic-Auth icon indicating copy to clipboard operation
Basic-Auth copied to clipboard

WP rest api plugin Create user Error

Open dharmeshtops opened this issue 8 years ago • 2 comments

i want to create/insert new user using rest api but i am getting this type of error. also i am using auth1.0 consumer and secret in auth1.0 method in postman. Error code: [ { "code": "json_user_cannot_list", "message": "Sorry, you are not allowed to list users." } ]

dharmeshtops avatar Feb 11 '17 14:02 dharmeshtops

No news about that? I have problems either

carl0s avatar Feb 26 '17 16:02 carl0s

Your question isn't related to authentication, rather authorization. You need to give the user who is making the REST call permission to both create and list users.

$user = new WP_User( $user_id );
$user->add_cap( 'create_users' );
$user->add_cap( 'list_users' );

BrianHenryIE avatar Aug 08 '17 22:08 BrianHenryIE