WP-API / node-wpapi

An isomorphic JavaScript client for the WordPress REST API
http://wp-api.org/node-wpapi/
MIT License
1.68k stars 191 forks source link

Sorry, you are not allowed to create posts as this user #475

Open jonaslund opened 4 years ago

jonaslund commented 4 years ago

The famous authentication issue {code: "rest_cannot_create", message: "Sorry, you are not allowed to create posts as this user.", data: {…}}

There's no viable solutions or documentation and I've tested both the Basic Auth and the Application Passwords plugin but nothing seem to work.

Any solution for nginx?

travis-st commented 3 years ago

I had a similar problem for using the wp-json REST API to upload images.

I didn't do anything different for Nginx.

I installed the "Application Passwords" plugin. I went to my user in WordPress. Down near the bottom, it says "Application Passwords" and I created a new one called "REST API", and then copied that back to the script that I'm using and it worked.

The combination that worked was the regular username (Travis) and the password created by the "Application Passwords" tool. For my Nginx configuration I just used this:

https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/

Hope this helps!

garryreeve commented 3 years ago

I am experiencing the same issue with Nginx setup. I am using Basic Auth and Application Passwords and this has not helped (I am using the correct combination of account username and not password name).

Are there any other potential solutions?

AleAntonellis commented 3 years ago

I had a similar problem for using the wp-json REST API to upload images.

I didn't do anything different for Nginx.

I installed the "Application Passwords" plugin. I went to my user in WordPress. Down near the bottom, it says "Application Passwords" and I created a new one called "REST API", and then copied that back to the script that I'm using and it worked.

The combination that worked was the regular username (Travis) and the password created by the "Application Passwords" tool. For my Nginx configuration I just used this:

https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/

Hope this helps!

Thanks a lot @travis-st it works for me

andrehenriquemendes commented 3 months ago

Commenting for those who are facing this problem, and was not able to solve by applying the suggestions above.

Make sure you're calling your endpoint with "https" instead of "http", spent hours to find out it.