Skip to content

{"message":"unauthorized"} when using JS SDK with Parse-Server #1539

Closed
@mindgrub-jkliphouse

Description

@mindgrub-jkliphouse

Environment Setup

My issue is very similar to this one.

I'm using "parse-server": "^2.2.7" with "parse": "^1.8.3".

I forked the Parse-Server-Example and everything works fine locally and on Heroku with the Rest API. As soon as I try to use the javascript sdk I get {"message":"unauthorized"}.

I've tried with and without a javascriptKey, with or without initializing parse, with and without useMasterKey = true.

Steps to reproduce

This curl works:

curl -X GET \ -H "X-Parse-Application-Id: myAppId" \ -H "Content-Type: application/json" \ http://localhost:1337/parse/classes/_User

But this query gets {"message":"unauthorized"}:

```var User = Parse.User; //also tried Parse.Object.extend("_User");

    var query = new Parse.Query(User);
    query.useMasterKey = true; //tried it like this or by passing an object into find
    query.find().then(function(result) {
        if(result != null) console.log(JSON.stringify(result));
        else renderInvalidLogin(res);
    },
    function(error) {
        console.log(JSON.stringify(error));
        renderInvalidLogin(res);
    });```

Logs/Trace

No logs to trace. I'm really at a loss, I posted on SO 2 days and no comments or answers. So I'm posting here. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions