Parse REST api Logout 401 unauthorized

K.Kan

I am using the Parse REST API in my javascript app and struggling to get the logout function working.

I can login and signup users just fine but logging out throws an error 'POST https://api.parse.com/1/logout 401 (Unauthorized)'.

here is my code:

logout: function(user) {
  var config = {
    headers:{
        'X-Parse-Application-Id': PARSE_CREDENTIALS.APP_ID,
        'X-Parse-REST-API-Key':PARSE_CREDENTIALS.REST_API_KEY,
        'X-Parse-Session-Token': user.sessionToken
    }
  };
  return $http.post('https://api.parse.com/1/logout', config);
}

I am successfully getting the current users sessionToken but it just doesn't seem to work.

Am I missing something here. Any help would be greatly appreciated.

Seb

Actually I just found the answer here: Parse Logout 401 unauthorized using REST api

Just adding and empty data attribute worked for me as well! This is the code:

// define an empty object as required by $http
var 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
        }
});

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

jBPM Business Central rest api 401 unauthorized

Angular Rest API call returning 401 Unauthorized

Partner Central rest api 401 unauthorized access

401 (Unauthorized) | Cosmos DB rest API | rest-from-.net

VSTS REST API: 401 Unauthorized on work items API

Sending Push Through Parse API Results in 401 Unauthorized

Unauthorized (401) when I try to access JIRA REST API with PHP

REST API Batch Processes - 401 Unauthorized (User is not authenticated in expected context)

HP ALM 12.21 REST API - 401 Unauthorized - C#

yii2 rest api basic auth throws 401 unauthorized

401 Unauthorized on dropbox API

401 unauthorized github api

Loopback Logout from React returns 401 (Unauthorized)

Jujucharms API error 401 unauthorized

Getting 401 unauthorized status in an API

Kubernetes REST API - Unauthorized

Unauthorized access to REST API

Django Rest Framework: HTTP 401 Unauthorized error

The remote server returned an error: (401) Unauthorized. while using Paypal Rest APi

Framework.net service, using ConfidentialClientApplication and the Outlook Tasks REST API, got StatusCode: 401, ReasonPhrase: 'Unauthorized'

Is "logout" useless on a REST API?

401 Unauthorized on Google Photos API with API Key

401 Unauthorized error Binance API in r

Postman Google API request gives "401: Unauthorized"

401 Unauthorized Request Discord API with OAuth

Google API with GoogleSignIn - Error 401 - unauthorized

Using Google Calendar API returns 401 (unauthorized)

Web API 2: Random 401 unauthorized on POST

Axios with OMDB API, getting 401 Unauthorized