Skip to content Skip to sidebar Skip to footer

Parse Logout 401 Unauthorized Using Rest Api

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://ap

Solution 1:

I encountered this issue and this is what I've found so far -

Angular $http provider seems to require a data content for POST request

https://docs.angularjs.org/api/ng/service/$http#post

Adding an empty data object solved this problem:

// define an empty object as required by $httpvar mydata = {};
return $http.post(EXPRESSAPP.X_REST_API + 'logout', mydata, {
    headers:{
        'X-Parse-Application-Id': PARSE_CREDENTIALS.APP_ID,
        'X-Parse-REST-API-Key': PARSE_CREDENTIALS.APP_ID,
        'X-Parse-Session-Token': data.sessionToken
        }
});

Post a Comment for "Parse Logout 401 Unauthorized Using Rest Api"