简体   繁体   中英

having trouble with parse sdk and node.js

I'm trying to do parse push with my node.js server and am getting "unauthorized" errors.

i tried looking up the documentation but couldn't find anything on github with the module

https://www.npmjs.com/package/parse

Is the nodejs parse sdk still being maintained?

Here is my code

var Parse = require('parse').Parse;
Parse.initialize(config.get('parse_app_id'), config.get('parse_master_key'));

Parse.Push.send({
    channels: phoneNumbers,
    data: {
        alert: message
    }
}, {
    success: function () {
        callback();
    },
    error: function (error) {
        callback(error);
    }
});

I tried the same push call with node-parse-api and it worked.

This is working for me with promises:

var Parse = require('Parse').Parse;

Parse.initialize(...);

Parse.Push.send({
  channels: [],
  data: {parsekey: 'parseval'}
}).then(function (result) {
  console.log(result);
});

Output:

{ result: true }

The npm package is the official JS library, so I would be very surprised if it was obsoleted.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM