Title: Rest cannot create error
Last modified: January 18, 2017

---

# Rest cannot create error

 *  [Brijesh Borad](https://wordpress.org/support/users/brijesh2911/)
 * (@brijesh2911)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/rest-cannot-create-error/)
 * Hello
    I am using wordpress’ default wp rest api feature and [WP OAuth Server](https://wordpress.org/plugins/oauth2-provider/)
   plugin. I am getting access token when i tried to call endpoint to create post
   with POST request but still i am getting this response
 *     ```
       {
         "code": "rest_cannot_create",
         "message": "Sorry, you are not allowed to create posts as this user.",
         "data": {
           "status": 401
         }
       }
       ```
   
 * Access token is valid though i am not able to create post with json endpoint.
   I don’t know what is the issue. I have checked database,too and found that the
   access token is valid for the user who is administrator of site.
 * That means plugin doesn’t make user logged in because to create post user must
   be logged in and user should have capabilities for that.
 * Please help me out for this problem as soon as possible.
 * Thanks in advance.

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Plugin Author [Justin Greer](https://wordpress.org/support/users/justingreerbbi/)
 * (@justingreerbbi)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/rest-cannot-create-error/#post-8670522)
 * Thanks for using WP OAuth Server and sorry for the issues. Common causes for 
   this issue is:
 * – Being logged into WordPress and attempting to use an access token.
 * Solution:
 * – Ensure you are logged out of WordPress before attempting to make calls using
   the access token.
    -  This reply was modified 9 years, 4 months ago by [Justin Greer](https://wordpress.org/support/users/justingreerbbi/).
 *  [James Nylen](https://wordpress.org/support/users/jnylen0/)
 * (@jnylen0)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/rest-cannot-create-error/#post-8688004)
 * Hi [@brijesh2911](https://wordpress.org/support/users/brijesh2911/) – you might
   also try hitting the `/users/me` endpoint. This will tell you if the API thinks
   you are logged in or not.
 *  Plugin Author [Justin Greer](https://wordpress.org/support/users/justingreerbbi/)
 * (@justingreerbbi)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/rest-cannot-create-error/#post-8688018)
 * [@brijesh2911](https://wordpress.org/support/users/brijesh2911/),
 * Were you able to get get your solution working? If so, please share 🙂
 *  Thread Starter [Brijesh Borad](https://wordpress.org/support/users/brijesh2911/)
 * (@brijesh2911)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/rest-cannot-create-error/#post-8728656)
 * Hello, [@justingreerbbi](https://wordpress.org/support/users/justingreerbbi/)
   
   Thanks for your response. I am trying to do that from another website. Should
   it work with that?
 *  Plugin Author [Justin Greer](https://wordpress.org/support/users/justingreerbbi/)
 * (@justingreerbbi)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/rest-cannot-create-error/#post-8731655)
 * It would depend on how you are making the call from website to website. If you
   are making the call that is using the browser, then there is no need to include
   the access token. You would be considered logged in and it would use cookie auth.
 * There is issues where even if you send a valid request to the REST API using 
   browser based calls, then the two authentication methods (cookie and OAuth2) 
   will clash and treat the call like an invalid users.
 *  Thread Starter [Brijesh Borad](https://wordpress.org/support/users/brijesh2911/)
 * (@brijesh2911)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/rest-cannot-create-error/#post-9348519)
 * Thanks [@justingreerbbi](https://wordpress.org/support/users/justingreerbbi/),
   But I was trying to call it using POSTMAN and also from my localhost to live 
   site. How will it work?
 *  Plugin Author [Justin Greer](https://wordpress.org/support/users/justingreerbbi/)
 * (@justingreerbbi)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/rest-cannot-create-error/#post-9349283)
 * Forgive me. I thought you were using a site to try and connect.
 * > Thanks for your response. I am trying to do that from another website. Should
   > it work with that?
 * You will only be able to use Authorization Code is you are using the version 
   here on .org. POSTMAN will only work when using the access token and not to gain
   the access toke (again, with the version here on .org).
 * Please share your workflow. Are you actually getting a valid access token? If
   so, what is the request you are using to call the REST API?
 *  [jacques GNACADJA](https://wordpress.org/support/users/jgnacadja/)
 * (@jgnacadja)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/rest-cannot-create-error/#post-9445701)
 * hello,
    May be it’s too late to help, but i got the same issue. What i did was,
   to log out wordpress admin panel and try to send the basic Authentication Post
   request. surprise!!! this worked for me. I can’t explain why but it’s seem like
   the authentication process failed when you are already connected.
 *  Plugin Author [Justin Greer](https://wordpress.org/support/users/justingreerbbi/)
 * (@justingreerbbi)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/rest-cannot-create-error/#post-9445721)
 * Hi,
 * What you are experiencing is correct and not an oversight. WP REST can not choose
   which type of authentication to go with so it will fail. You can not be logged
   into WordPress via cookies and attempt to use any HTTP request with an access
   token. This is result is a failed authentication.
 * You MUST use only one authentication method at a time. More than one, authentication
   will fail.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Rest cannot create error’ is closed to new replies.

 * ![](https://ps.w.org/oauth2-provider/assets/icon-256x256.gif?rev=2603051)
 * [WP OAuth Server (OAuth Authentication)](https://wordpress.org/plugins/oauth2-provider/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/oauth2-provider/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/oauth2-provider/)
 * [Active Topics](https://wordpress.org/support/plugin/oauth2-provider/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/oauth2-provider/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/oauth2-provider/reviews/)

## Tags

 * [OAuth2](https://wordpress.org/support/topic-tag/oauth2/)
 * [post](https://wordpress.org/support/topic-tag/post/)
 * [request](https://wordpress.org/support/topic-tag/request/)
 * [wp rest api](https://wordpress.org/support/topic-tag/wp-rest-api/)

 * 9 replies
 * 4 participants
 * Last reply from: [Justin Greer](https://wordpress.org/support/users/justingreerbbi/)
 * Last activity: [8 years, 9 months ago](https://wordpress.org/support/topic/rest-cannot-create-error/#post-9445721)
 * Status: not resolved