Skip to content

Error unauthorized with local parse-server #901

Closed
@simonecogno

Description

@simonecogno

Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Dashboard!

  • You're running version >=1.0.23 of Parse Dashboard.

  • You're running version >=2.3.2 of Parse Server.

  • You've searched through existing issues. Chances are that your issue has been reported or resolved before.

Environment Setup

I've installed parse server with express.

   const ParseServer = require('parse-server').ParseServer;
    let app = express();

    // Api routes
    let routerApi = new ParseServer({
        databaseURI: 'mongodb://localhost:27017/test1', // Connection string for your MongoDB database
        cloud: global.appRoot + '/server/cloud/main.js', // Absolute path to your Cloud Code
        appId: 'myAppId',
        masterKey: 'myMasterKey', // Keep this key secret!
        fileKey: 'optionalFileKey',
        serverURL: 'http://localhost:1337/parse' // Don't forget to change to https if needed
    });

    app.use('/parse', routerApi);

    const server = http.createServer(app);

    server.listen(port, function() {
          server.emit('started');
    );
    ....

This installation works as I can save objects with cURL and query for objects like _Installation and _User.

Then I've installed a dashboard with the following config:

{
  "apps": [
    {
          "serverURL": "http://localhost:1337/parse",
          "appId": "myAppId",
          "masterKey": "myMasterKey",
          "appName": "xxx  (local machine)"
    }
  ],
  "users":[{
     "user":"Simone",
     "pass":"xxxx",
     "apps": [{"appId":"myAppId"}]
  }]
}

Parse dashboard cannot access to parse-server with unauthorized error (see logs error).

Steps to reproduce

I'm not able at the moment to provide an example project. Maybe already with the information I've provided, it's possible to guess a problem.

Logs/Trace

Note: If you get a browser JS error please run npm run dev. This will provide source maps and a much more useful stack trace.

Parse dashboard gives me unauthorized error. Actually the request it fails is the following (copied from chrome browser):

curl 'http://localhost:1337/parse/serverInfo' -H 'Referer: http://xxx/apps' -H 'Origin: http://xxx' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36' -H 'Content-Type: text/plain' --data-binary '{"_method":"GET","_ApplicationId":"myAppId","_ClientVersion":"js1.9.2","_MasterKey":"myMasterKey","_InstallationId":"xxx"}' --compressed

res: 403 Forbidden {"error":"unauthorized"}

The same result also is shown if executed this command from the terminal.

If I do a GET request for serverInfo it works:

curl -X GET \
  http://localhost:1337/parse/serverInfo \
  -H 'cache-control: no-cache' \
  -H 'postman-token: xxxx' \
  -H 'x-parse-application-id: myAppId' \
  -H 'x-parse-master-key: myMasterKey' \

res: 200 {...server info...}

Any idea how to solve this issue?

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