Parse-server: Parse server unauthorized

Created on 22 Jun 2016  路  5Comments  路  Source: parse-community/parse-server

result ->{"error":"unauthorized"}

'use strict';
var express = require('express');
var nconf = require('nconf');
var ParseServer = require('parse-server').ParseServer;
var path = require('path');

nconf.argv().env().file({ file: 'config.json' });

var app = express();
var parseServer = new ParseServer({
databaseURI: nconf.get('DATABASE_URI') || 'mongodb://localhost:27017/dev',
cloud: nconf.get('CLOUD_PATH') || path.join(__dirname, '/cloud/main.js'),
appId: nconf.get('APP_ID'),
masterKey: nconf.get('MASTER_KEY'),
fileKey: nconf.get('FILE_KEY'),
serverURL: nconf.get('SERVER_URL')
});
app.use(process.env.PARSE_MOUNT_PATH || '/parsemonterrico', parseServer);
app.get('/', function (req, res) {
res.status(200).send('Servidor funcionando :V !');
});

var server = app.listen(process.env.PORT || 8080, function () {
console.log('App listening on port %s', server.address().port);
console.log('Press Ctrl+C to quit.');
});

All 5 comments

Check and double-check your application id.

review the application id, and is not the problem'm using MLAB for the database you think is the problem

var api = new ParseServer(
{
databaseURI: 'mongodb://XXXX:[email protected]:17584/xxxxxx',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || 'xxxxxxxxxxxxxxxxx',
masterKey: process.env.MASTER_KEY || 'xxxxxxxxxxxxxxxx',
clientKey: process.env.CLIENT_KEY || 'xxxxxxxxxxxxxxxxxxx',
serverURL: 'http://localhos'+ port+'/parse',
fileK: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx',
}
);

Post your config.json file please.

{
"DATABASE_URI": "mongodb://xxxx:[email protected]:17584/xxxxxx",
"CLOUD_PATH": "./cloud/main.js",
"APP_ID": "xxxxxxxxxxxxxxx",
"MASTER_KEY": "xxxxxxxxxxxxxxxxx",
"FILE_KEY": "ac494c9a-x-x-x-a9495751009f",
"PARSE_MOUNT_PATH": "/parse",
"SERVER_URL": "http://localhost:1337/parse"
}

{
"apps": [
{
"serverURL": "https://api.parse.com/1", // Hosted on Parse.com
"appId": "xxxxxxxxxxxxxxxxx",
"masterKey": "xxxxxxxxxxxxxxxx",
"javascriptKey": "xxxxxxxxxxxxxx",
"restKey": "xxxxxxxxxxxxx",
"appName": "x x.x x",
"production": true
},
{
"serverURL": "http://localhost:1337/parse", // Self-hosted Parse Server
"appId": "xxxxxxxxxxxxxxx",
"masterKey": "xxxxxxxxxxxxxxxxx",
"appName": "My Parse Server xxx"
}
]
}

You may use Server Fault for questions about managing Parse Server.

For code-level and/or implementation-related questions or technical support, please refer to Stack Overflow.

Was this page helpful?
0 / 5 - 0 ratings