Title: Logout endpoint
Last modified: October 17, 2018

---

# Logout endpoint

 *  Resolved [botoxparty](https://wordpress.org/support/users/adamhammad/)
 * (@adamhammad)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/logout-endpoint/)
 * I’d like to propose a logout endpoint that calls wp_logout() to remove any cookies.
 * I’m using something basic like..
 *     ```
       add_action( 'rest_api_init', function () {
               register_rest_route( 'custom', 'v1/logout', array(
               'methods' => 'GET',
               'callback' => 'custom_logout',
           ) );
       } );
   
       function custom_logout() {
           return wp_logout();
       }
       ```
   
 * Not sure if i’m missing or anything but yeah not calling wp_logout() was causing
   a lot of problems for my frontend.

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

 *  Plugin Author [Ali Qureshi](https://wordpress.org/support/users/parorrey/)
 * (@parorrey)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/logout-endpoint/#post-10791416)
 * Hello,
 * When you use generate_auth_cookie, you have the option to create the cookie value
   for a specific time period. please note, though it is cookie value, but no cookie
   is created or written in browser as you are using REST API. there is no cookie
   to unset in the first place in your mobile app.
 * It will only work if you are using browser and using REST API to login web app.
   FOr mobile app, forget cookie value is better option.
 * Thank you for posting the solution that may work for eb apps.
 *  Thread Starter [botoxparty](https://wordpress.org/support/users/adamhammad/)
 * (@adamhammad)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/logout-endpoint/#post-10798351)
 * Ahh okay. There are cookies that are being set in my app. My app uses WooCommerce
   and they are coming from there to track cart sessions.
 * So yeah anyone out there who is having problems with WooCommerce sessions, make
   sure you unset your cookies when you get rid of your token, or call wp_logout().

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

The topic ‘Logout endpoint’ is closed to new replies.

 * ![](https://ps.w.org/json-api-user/assets/icon-256x256.png?rev=1965790)
 * [JSON API User](https://wordpress.org/plugins/json-api-user/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/json-api-user/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/json-api-user/)
 * [Active Topics](https://wordpress.org/support/plugin/json-api-user/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/json-api-user/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/json-api-user/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [botoxparty](https://wordpress.org/support/users/adamhammad/)
 * Last activity: [7 years, 7 months ago](https://wordpress.org/support/topic/logout-endpoint/#post-10798351)
 * Status: resolved