GraphQL Cookbook

Logging out a logged user through the Parse GraphQL API

Problem

You want to log out a logged user in your backend through the Parse GraphQL API.

Solution

Using the Parse GraphQL API, you can log out a logged user just by sending the user’s sessionToken through the X-Parse-Session-Token header (as described in the authenticating a user recipe) and calling the logOut mutation. Parse Server will destroy the sessionToken and it will not be accepted for any other future request.

Example:
1
2
3
4
5
mutation LogOut {
  users {
    logOut
  }
}
Result:
1
2
3
4
5
6
7
{
  "data": {
    "users": {
      "logOut": true
    }
  }
}