Skip to content

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

Description

@maruthi-wal
No description provided.

Activity

  1. maruthi-wal commented on Mar 1, 2016

    @maruthi-wal
    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,

  2. flovilmart commented on Mar 1, 2016

    @flovilmart
    Contributor

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

  3. maruthi-wal commented on Mar 1, 2016

    @maruthi-wal
    Author

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

  4. mithleshjs commented on Mar 1, 2016

    @mithleshjs

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

  5. maruthi-wal commented on Mar 2, 2016

    @maruthi-wal
    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
    });

  6. AlecKriebel commented on Mar 2, 2016

    @AlecKriebel

    @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?

  7. maruthi-wal commented on Mar 3, 2016

    @maruthi-wal
    Author

    @AlecKriebel Thanks. Its working for me..

  8. AlecKriebel commented on Mar 3, 2016

    @AlecKriebel

    @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.

  9. maruthi-wal commented on Mar 3, 2016

    @maruthi-wal
    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.

  10. mahabubakram commented on Mar 4, 2016

    @mahabubakram

    { 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions