Parse-dashboard: Server not reachable: unauthorized when running with express

Created on 3 Jun 2016  路  30Comments  路  Source: parse-community/parse-dashboard

Hi guys

I have a problem when trying to star parse-server and parse-dashbord on the same port like this https://github.com/ParsePlatform/parse-dashboard#running-as-express-middleware

Parse-server OK but Parse-dashboard can get https://**.com/api/serverInfo (403 forbidden)

If I start parse-dashboard with cli it's work :
parse-dashboard --config /path/parse-dashboard-config.json

same config for both methods but the first can't reach the parse-server

Update : when I disable user basic auth it's work

var dashboard = new ParseDashboard({
    // Parse Dashboard settings
    'apps': [
        {
          'serverURL': 'https://****.com/api',
          'appId': 'myAppId',
          'masterKey': 'myMasterKey',
          'appName': 'MyApp'
        }
    ],
    /*'users': [
        {
          'user':'test',
          'pass':'test'
        }
    ]*/
});

Any idea ?

Most helpful comment

I investigated this further and for me it boils down to commit https://github.com/ParsePlatform/parse-server/commit/03108e634776ebeda71c0c3159f8fbedff1b796c

I'm running my parse dashboard under an already basic auth protected /admin route so when I request /admin/dashboard (where my Parse dashboard is running) I'm getting appId and masterKey will be replaced by my basic auth username/password which isn't the idea.

All 30 comments

Can you post your server logs?

@drew-gross webserver logs ?

The 403 forbidden error on the /serverInfo endpoint means you have incorrect auth somewhere. The server logs might show which auth is incorrect.

I think it's related to some SSL changes (think I read about that in the changelog). I've just upgraded to latest parse server and parse dashboard and is seeing connection issues myself. Only with HTTPS, though.

I investigated this further and for me it boils down to commit https://github.com/ParsePlatform/parse-server/commit/03108e634776ebeda71c0c3159f8fbedff1b796c

I'm running my parse dashboard under an already basic auth protected /admin route so when I request /admin/dashboard (where my Parse dashboard is running) I'm getting appId and masterKey will be replaced by my basic auth username/password which isn't the idea.

Hello people, any update on this issue? I'm facing the exact same issue as @messi89

Still stymied by this; it just started all of a sudden, not sure why and when it started. I've tried downgrading the installation and that doesn't solve it at all.

Note that unlike @messi89 if I disable user basic auth, I get a blue screen saying a user must be enabled to use the dashboard. :-)

I haven't been able to look further into it but I'm still seeing the issue.

Thanks for your feedback @theill

When using the same port for dashboard and server it was working. I updated the server and dashboard and now is not working :( I'm able to log in into the dashboard but I can't access my app, it is unauthorized.

Thanks

@eduardo22i What version were you on before you upgraded?

@ugommirikwe
server: 2.2.10
dashboard: 1.0.12

I am experiencing this as well after updating 1 of my parse server to 2.2.14, I was able to access my parse server via parse dashboard just fine before, and suddenly this was happened. Other parse servers of mine are working fine.

After inspecting, I found out that the difference between my working parse servers with the non working one is the request from parse dashboard to the non working parse server has basic auth in the header, while the others don't, here are the example:

curl 'https://myparseserver.com/parse/serverInfo' -H 'Pragma: no-cache' -H 'Origin: https://myparseserver.com' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: en-US,en;q=0.8,id;q=0.6,ms;q=0.4,th;q=0.2,fr;q=0.2,ru;q=0.2' -H 'Authorization: Basic 12345678910ImaginaryAuthKey' . . .

I agree with @theill it seems like this https://github.com/ParsePlatform/parse-server/pull/1706 is the cause, would be awesome if @hmoqhim can revisit the pull request.

Anyway, I downgraded to parse server 2.2.10 and it's working fine again now.

@ayublin Thanks for your update.

But I've downgraded both Parse-Server and Parse-Dashboard all the way to 2.2.8 and 1.0.8, and still having the issue. Anyone have a suggestion why this will still persist even after downgrading to previously working versions? Thanks

@ugommirikwe Hey, I didn't downgrade parse dashboard, only the parse server, have you restarted parse server after downgrading?

Yeah @ayublin I restarted.

Well, people, I seem to have resolved the issue by looking at issue #118 (duplicate issue) which is really exactly what this issue is about.

Because I am running both Parse-Dashboard module and the Parse-Server module on the same server, I simply used "http://localhost:PORT/SERVER_MOUNT_PATH" as the "serverURL" property for both the Parse-Server and Parse-Dashboard config object. And there lies the problem.

Following the suggestion in issue #118 I simply replaced the "serverURL" property for the Parse-Dashboard config object (i.e. the config.apps[x].serverURL property) to the external IP address (i.e. the IP address of the server with which other machines can reach it across the network) of the server machine; I then restarted the app and the "unable to reach..." issue disappeared; Parse-Dashboard was able to connect to the Parse-Server and render data from it correctly.

Someone else should try this and confirm this solves the issue for them.

Hi,

I don't whether I should report it here or create another issue. There are lots of similar issues I have gone, but none of them helped to resolve the same. I was just experimenting with parse server.

I have installed the latest version of parse-server example on my localhost ran it. The test page shows it works ( http://127.0.0.1:1337/test ) , curl shows it is working.

But when I start parse-dashboard I am getting 403 (Forbidden) .

Installed

mkdir parse-dashboard
cd parse-dashboard
npm install -g parse-dashboard

Tried to start and that parse-dashboard command failed.

parse-dashboard --appId yourAppId --masterKey yourMasterKey --serverURL "https://example.com/parse" --appName optionalName

Looking again I noticed the path where it got installed

/usr/local/nodejs/bin/parse-dashboard -> /usr/local/nodejs/lib/node_modules/parse-dashboard/bin/parse-dashboard
/usr/local/nodejs/lib

So started with

/usr/local/nodejs/bin/parse-dashboard --appId parse-app-id --masterKey parse-password --serverURL "http://localhost:1337/parse" --appName First

It failed with 403

POST http://localhost:1337/parse/serverInfo 403 (Forbidden)
POST http://localhost:1337/parse/classes/_Installation 403 (Forbidden)
POST http://localhost:1337/parse/classes/_User 403 (Forbidden)

So I created a config file and tried.

{
  "apps": [
    {
      "serverURL": "http://localhost:1337/parse",
      "appId": "parse-app-id",
      "masterKey": "parse-password",
      "appName": "MyApp"
    }
  ]
}

So I thought it can be due to the appId and masterKey having a - . So removed and started the parse-server-example app. The values are modifeid in app.yaml file of the parse-server-example .

Still got the 403, tested on test page and all looks good.

So it looks the configuration was not read, so I edited the file /usr/local/nodejs/lib/node_modules/parse-dashboard/Parse-Dashboard/parse-dashboard-config.json to keep all the values still it didn't worked to get the app getting connected on dashboard.

I tried these variations also localhost to 127.0.0.1 etc .

I am new to node so this is how I tried to log

npm start > my_app_log.log 2> my_app_err.log

taken from http://stackoverflow.com/questions/10815218/where-is-nodejs-log-file for the server log was asked. But I could find much information regarding the failed attempt other than it gets connected etc. The only piece of information I have is

> [email protected] start /var/www/projects/github.com/harikt/parse-server
> node index.js

DATABASE_URI not specified, falling back to localhost.
parse-server-example running on port 1337.

In case anyone need anything let me know. Probably you should keep in mind I am not a nodejs expert so may need additional information or links to do the same.

@harikt Why don't you try the solution I used: instead of typing 127.0.0.1 or localhost for the serverURL property of the Parse-Dashboard config object, enter the actual IP address of the server you are running the Parse-Server module on. For example, if the IP address of the server where Parse-Server module is running is 192.168.137.12, then that's what you should insert as the serverURL property in the Parse-Dashboard module config, even if both the Parse-Server and the Parse-Dashboard modules are running on the same server.

@ugommirikwe Thank you for the help.

It actually opened another door when I was looking. The app.yaml is not taken by npm start . So the appid and master key was not set. ( I was looking at the post request of the test url ) . So I modifed the index.js of the parse-server-example . Is there a way we can configure the appid / master key to the environment other than editing index.js ?

And we don't need to change the ip at all in this case.

Thank you

@harikt you can set the variables in the environment. I don't know where your app.yaml comes from, but you're right, it's not handled by parse server.

@flovilmart I was going to give the link and noticed the commit message on it for google app engine . https://github.com/ParsePlatform/parse-server-example/blob/084fa077fcad32520b6935049fe23d7acef4b77c/app.yaml

I'm getting the same thing on Parse server version 2.2.12, dashboard version 1.0.13.

403 on the /serverInfo endpoint, User endpoint, and Installation endpoint when trying to load the dashboard.

I've been reading and it appears that the initial assumption is that the master key and app id's are incorrect in the server.js file (for express apps) or config file (for non express apps).

If I disable the basic auth, I can run the following, which leads me to believe that my master key and app id are indeed correct. (If I use erroneous keys I get an unauthorized error):

curl -X GET \ -H "X-Parse-Application-Id: my_app_id_here" \ -H "X-Parse-Master-Key: my_master_key_here" \ https://mydomain.com/parse/classes/ApprovedUser -k

If it isn't a key issue, what is the next step for diagnosing this?

Thanks,
Matt

In my case I receive the same error, but discovered that it is a problem with https by more that have the same call from ip on the server and the dashboard, this gives me back 403. But when manually charge the dashboard without using PM2 and express:

parse-dashboard --config 1.json --sslKey "privkey.pem" --sslCert "cert.pem"

It works perfect, but I can not place it within the structure of my index.js to execute with PM2.

I can not get to read the sslKey and sslCert parameters, such as:

...
 "env": {
      "PARSE_DASHBOARD_SSL_KEY": "/home/user/privkey.pem",
      "PARSE_DASHBOARD_SSL_CERT": "/home/user/cert.pem",
    }
...

or

...
    "sslKey": "/home/user/privkey.pem",
    "sslCert": "/home/user/cert.pem",
...

any ideas?

Thank you

The same problem here: the newest standalone Parse Server (2.2.17) & Parse Dashboard (1.0.15) based on a Bitnami stack with SSL only, custom domain, static IP.

All is working until I add the "user" authentication block to the Parse Dashboard config file (at Bitnami it's actually one file for server&dashboard), then the Dashboard can be accessed with the correct credentials but the Parse Server NOT. Next to the app in the Dashboard one can read: "Server not reachable: unauthorized". The port 1337 is obviously blocked.

I haven't found a solution for a few days, hope that a fix comes soon :o)

Same problem with the same settings as @bosparki (bitnami, SSL, 2.2.17/1.0.15, etc.)

I'm having the same issue as @boparski and @jeleed - started after I added the "user" authentication block as @boparski describes. Same config - Bitnami etc. Take away the user block from server.js dashboard items and the dashboard to server connection works.

@sjmn I had the same problem but it worked after I changed to per app auth, using the same basic auth. I have no idea why it worked but it'd be interesting to see if it can work for you, or not.

thanks @Sguo12 - that worked for me too. So to be clear, here's how the Dashboard settings inside server.js look now with it working:

//Parse Dashboard
var ParseDashboard = require('parse-dashboard');
var dashboard = new ParseDashboard({
apps: [
{
appName: "myAppName",
appId: "myAppId",
masterKey: "myMasterKey",
fileKey: "myFileKey",
production: true,
serverURL: 'https://my.server.IP.address/parse',
user: 'myUser',
pass: 'myPassword'
}
]
});

hi guy, if you got an unauthorized error go to app.json file of parse-server and check master key and appId. They should match to values used in index.js of parse-server

@bitf12a046 thanks man... your answer is correct... :-)

Was this page helpful?
0 / 5 - 0 ratings