parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

Local Parse Server throwing 'unauthorised' 403 despite correct keys

Open ryderjack opened this issue 10 years ago • 8 comments

I'm setting my keys as described yet still getting 'Unauthorised'. Any ideas why this is?

Here's the snippet where I create the server var:

var express = require('express');
var ParseServer = require('parse-server').ParseServer;

var app = express();

var port = process.env.PORT || 1337;

// Specify the connection string for your mongodb database
// and the location to your Parse cloud code
var api = new ParseServer({
  databaseURI: 'mongodb://localhost:27017',
  cloud: '/Users/jack/Desktop/dev/node_modules/parse-server/lib/cloud/main.js', // Provide an absolute path
  appId: 'jack1234',
  masterKey: 'jack1234',
  serverURL: 'http://localhost:' + port + '/parse'
});

// Serve the Parse API on the /parse URL prefix
app.use('/parse', api);

// Hello world
app.get('/', function(req, res) {
  res.status(200).send('Express is running here.');
});

app.listen(port, function() {
  console.log('parse-server-example running on port ' + port + '.');
});

Here's a screenshot of the 'Unauthorised' with the headers:

image

ryderjack avatar Feb 19 '16 15:02 ryderjack

Have you tried it without ' ? just jack1234 as keys?

merowinger92 avatar Feb 19 '16 15:02 merowinger92

@merowinger92 I get- "Cannot GET /parse"

ryderjack avatar Feb 19 '16 17:02 ryderjack

/parse isn't a route. /parse/classes/TestObject would be a route you can test...

gfosco avatar Feb 19 '16 20:02 gfosco

@gfosco how would you suggest adding a class & object to test?

ryderjack avatar Feb 19 '16 20:02 ryderjack

It happens automatically if you save an object with an sdk or with the rest API, and you can just query against the url even if it doesn't exist.

gfosco avatar Feb 19 '16 22:02 gfosco

@gfosco localhost:1337/parse/classes/testObject returns {"error":"unauthorized"} despite the headers being set as per the screenshot above

ryderjack avatar Feb 20 '16 00:02 ryderjack

I am getting the same message and dont know why. if not error:unauthorized , I get cannot POST ... or cannot GET, there is something else we need to do ? for what this line? cloud: 'parse-server/src/cloud/main.js', // Provide an absolute path

ofirattia avatar Feb 20 '16 07:02 ofirattia

I uninstalled and starting from the top with the Parse-Sever-example repo https://github.com/ParsePlatform/parse-server-example It must have been a set up issue

ryderjack avatar Feb 20 '16 17:02 ryderjack