我配置我的解析服務器如下:解析服務器:REST的API密鑰認證不起作用
var api = new ParseServer({
databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || 'XXXXXXXXXXXXXXX',
clientKey: process.env.CLIENT_KEY || 'XXXXXXXXXXXXXXX',
restAPIKey: process.env.RESTAPI_KEY || 'XXXXXXXXXXXXXXX',
masterKey: process.env.MASTER_KEY || 'XXXXXXXXXXXXXXX', //Add your master key here. Keep it secret!
...
serverURL: process.env.SERVER_URL || 'https://myserver.com:1337' // Don't forget to change to https if needed
});
發送推送消息的主鍵指定作品:
curl -X POST \
-H "X-Parse-Application-Id: XXXXXXXXXXXXXXX" \
-H "X-Parse-Master-Key: XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{
"where": {
"deviceType": {
"$in": [
"ios"
]
}
},
"data": {
"title": "The Shining",
"alert": "All work and no play makes Jack a dull boy."
}
}'\ https://myserver.com/parse/push
但是,如果我只提供其餘的API密鑰,它不起作用。
curl -X POST \
-H "X-Parse-Application-Id: XXXXXXXXXXXXXXX" \
-H "X-Parse-REST-API-Key": XXXXXXXXXXXXXXX \
-H "Content-Type: application/json" \
-d '{
"where": {
"deviceType": {
"$in": [
"ios"
]
}
},
"data": {
"title": "The Shining",
"alert": "All work and no play makes Jack a dull boy."
}
}'\ https://myserver.com/parse/push
我的服務器配置有什麼問題?我認爲只要我定義它,它應該與其他API密鑰一起工作?
*類*它的工作原理。謝謝 –