So, I'm trying to delete a Session object at Parse using the logout method calling the REST api.
Here is my code:
logout:function(data){
return $http.post('https://api.parse.com/1/logout',{
headers: {
'X-Parse-Application-Id': PARSE_CREDENTIALS.APP_ID,
'X-Parse-REST-API-Key': PARSE_CREDENTIALS.REST_API_KEY,
'X-Parse-Session-Token': data.sessionToken
}
});
}
The variables are correct, I've inspected the request headers using devTools and both the credentials and session token are being set correctly but I'm still getting the response status 401,
{error: "unauthorized"}
I know the logout concept does not apply to REST services, still, it creates a Session object whenever I log in a user. To avoid thousands of left over Sessions in my Parse app, I am trying to make the logout function to destroy the Session.