Skip to content

Master key is invalid, you should only use master key to send push #736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
maruthi-wal opened this issue Mar 1, 2016 · 10 comments
Closed

Comments

@maruthi-wal
Copy link

No description provided.

@maruthi-wal
Copy link
Author

Hello Everyone,

Iam getting Master key is invalid, you should only use master key to send push

Please find my cloud code below:

Parse.initialize("appid", "javascriptkey", "masterkey");
var pushQuery = new Parse.Query(Parse.Installation);
Parse.Push.send({

    channels: [ "Giants" ],
    data: {
        alert: "The Giants Mets 2-3."
    }
}, { useMasterKey: true });

My index.js code
var api = new ParseServer({
databaseURI: databaseUri,
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID,
masterKey: process.env.MASTER_KEY,
clientKey: process.env.CLIENT_KEY,
restAPIKey: process.env.REST_API_KEY,
fileKey: process.env.FILE_KEY,
serverURL: 'http://IP/parse',
push: {
ios:
[
{
pfx: __dirname + '/name.p12', // Prod PFX or P12
bundleId: id',

production: false // Prod
},
{
pfx: __dirname + '/name.p12', // Prod PFX or P12
bundleId: 'id',

production: true // Prod
}
]

}
});
Please help me on this
Thanks,

@flovilmart
Copy link
Contributor

Did you set your master key in the environment before starting your server? with: APP_ID=appid MASTER_KEY=masterKey node index.js

@maruthi-wal
Copy link
Author

Yes.. Master key and App Id i given.. Please help me on this..

@mithleshjs
Copy link

Pass the third argument as "true" to .send function.

@maruthi-wal
Copy link
Author

Its working for me. Thanks a lot for your suggestions.

My cloude code finally:

Parse.Push.send({
channels: ['Giants'],
data: {
alert: 'The Giants Mets 2-3.',
badge: 1,
sound: 'default'
}
}, {
success: function() {
console.log('##### PUSH OK');
},
error: function(error) {
console.log('##### PUSH ERROR');
},
useMasterKey: true
});

@AlecKriebel
Copy link

@maruthi-wal Did you still have to call Parse.initialize("appid", "javascriptkey", "masterkey");in the body of your cloud code function?

If you did, did you just copied and pasted the keys in as strings?

@maruthi-wal
Copy link
Author

@AlecKriebel Thanks. Its working for me..

@AlecKriebel
Copy link

@maruthi-wal It is not working for me. Did you still have the initialize call in your Cloud Code. I may need to add it to mine.

Thanks.

@maruthi-wal
Copy link
Author

@AlecKriebel Yep.. I added Parse.initialize("appid", "javascriptkey", "masterkey"); in my cloud code.

Make sure in index.js as below:
push: {
ios:
[
{
pfx: __dirname + '/name.p12', // Prod PFX or P12
bundleId: 'id',

production: false
}
]
}

Production should be false for testing.

@mahabubakram
Copy link

{ params: { id: '45J1QIaKIi' },
master: false,
user: { _objCount: 0, className: '_User', id: '45J1QIaKIi' },
installationId: '82e1d517-7aac-d887-d02b-e407c3de5e7f' }

PUSH OK

APNS Connection 0 Socket Error
APNS Connection 0 Socket Error
APNS Connection 0 Socket Error
APNS Connection 0 Disconnected
APNS Connection 0 Socket Error
APNS Connection 0 Disconnected
APNS Connection 0 Socket Error
APNS Connection 0 Socket Error
APNS Connection 0 Disconnected
APNS Connection 0 Socket Error
APNS Connection 0 Socket Error
APNS Connection 0 Disconnected
APNS Connection 0 Socket Error
APNS Connection 0 Socket Error
APNS Connection 0 Disconnected
APNS Connection 0 Socket Error
APNS Connection 0 Socket Error
APNS Connection 0 Disconnected
APNS Connection 0 Socket Error
APNS Connection 0 Socket Error
APNS Connection 0 Disconnected

how to solve this problem when I send push it performs success but the it also shows these in the console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants