0

I'm trying to delete one user from _User table of parse.com but I get an error.

I'm sure that the syntax of the request is fine, I'm getting this error:

code: 206
error: "Parse::UserCannotBeAlteredWithoutSessionError"

I think I shouldn't to do log-in to delete users, because I'm doing it on API REST.

$scope.delete = function (id) {
  $http({
     method: "DELETE",
     url: url_users + id,
     headers: {'X-Parse-Application-Id': appId,
               'X-Parse-REST-API-Key': restId}

  }).success(function (data) {
     debugger;
     swal("Deleted!", "All user data has been deleted", "success");
  }).error(function (data) {
    debugger;
     swal("Error!", "An unexpected error ocurred, try again!", "error");
  });
}

2 Answers 2

1

You're trying to remove a user from a different user session to remove. This does not work from the REST API, even if you use the X-Parse-REST-API-Key in the headers. The solution is to use Clode Code Function to delete or update a user from another session.

For more information see the documentation Parse Cloud Code Guide

The following response is the Code Clode Function to delete a user:

Parse User Destroy - Javascript in Cloud Code

Sign up to request clarification or add additional context in comments.

1 Comment

Please give more details in your answer and use the links as references, see meta.stackexchange.com/questions/8231/… for details.
0

I haven't tried doing this, but I have these ideas:

  • Make sure your ACL allows this to the public
  • Is it not acceptable to call a cloud code function? This would feel more intuitive to me than using the API in this case. Can you explain why you must use the REST API?
  • If that doesn't work, look at this answer: https://www.parse.com/questions/delete-a-user-rest-api

Basically you might have to pass the Master Key header, which is less than ideal to expose to the public. Is it not accep

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.