Skip to content

iOS SDK sends x-parse-client-key for push notifications but server expects X-Parse-Master-Key` #3455

Closed
@jaimeagudo

Description

@jaimeagudo

Issue Description

Describe your issue in as much detail as possible.

Using iOS SDK the headers when sending Push Notifications for the master-key are simply inconsistent following the tutorial. The SDK sends the key in x-parse-client-key but the REST is waiting for X-Parse-Master-Key. Hence my curl tests are fine but my iOS SDK is failing.

See https://github.com/ParsePlatform/parse-server/blob/f864141663533bc6195dcbd4622e735798bfac81/src/middlewares.js#L24

[FILL THIS OUT]

Steps to reproduce

Please include a detailed list of steps that reproduce the issue. Include curl commands when applicable.

  1. Open a sample iOS SDK Project
let push = PFPush()
        pushQuery.whereKey("user", equalTo:  PFUser.current()!)
        push.setQuery(pushQuery) 
        push.setMessage("hello world")
        push.sendInBackground()

Expected Results

The logs on server are ok, returns 200

Actual Outcome

"error": {
        "status": 403,
        "message": "unauthorized: master key is required"
    },

Environment Setup

  • Server

    • parse-server version (Be specific! Don't say 'latest'.) : 2.3.2
    • Operating System: Ubuntu 16.04
    • Hardware: LINODE
    • Localhost or remote server? Linode
  • Database
    IRRELEVANT

Logs/Trace

{
    "method": "POST",
    "url": "/parse/push",
    "headers": {
        "x-forwarded-for": "88.17.YY.XXX",
        "host":"myserver:41337",
        "x-nginx-proxy": "true",
        "connection": "upgrade",
        "content-length": "165",
        "x-parse-client-version": "i1.14.2",
        "accept": "*/*",
        "x-parse-session-token": "r:7df48309d473e1e9e403aa0c2e35dcfb",
        "x-parse-application-id": "MYAPP",                               
        "x-parse-client-key": "myprivatekey_justfine",
        "x-parse-installation-id": "12afc24d-37c0-484f-9e73-1bf6756c3d4c",
        "x-parse-os-version": "10.2 (16B2555)",
        "accept-language": "en-us",
        "accept-encoding": "gzip, deflate",
        "content-type": "application/json; charset=utf-8",
        "user-agent": "app/1 CFNetwork/808.2.16 Darwin/16.1.0",
        "x-parse-app-build-version": "1",
        "x-parse-app-display-version": "0.1"
    },
    "body": {
        "where": {
            "user": {
                "__type": "Pointer",
                "className": "_User",
                "objectId": "p1w7xaoRAL"
            }
        },
        "data": {
            "alert": "Carol J would love to work at Sonora Disco! Call him/her now!"
        }
    },
    "level": "verbose",
    "message": "REQUEST for [POST] /parse/push: {\n  \"where\": {\n    \"user\": {\n      \"__type\": \"Pointer\",\n      \"className\": \"_User\",\n      \"objectId\": \"p1w7xaoRAL\"\n    }\n  },\n  \"data\": {\n    \"alert\": \"Hi Carol !\"\n  }\n}"
}
1 | Paid2Par | {
    "error": {
        "status": 403,
        "message": "unauthorized: master key is required"
    },
    "level": "error",
    "message": "Error generating response. { Error: unauthorized: master key is required\n    at promiseEnforceMasterKeyAccess (/home/jaime/production/source/node_modules/parse-server/lib/middlewares.js:297:17)\n    at /home/jaime/production/source/node_modules/parse-server/lib/PromiseRouter.js:132:22\n    at process._tickDomainCallback (internal/process/next_tick.js:129:7) status: 403, message: 'unauthorized: master key is required' }"
}
1 | myapp | Error: unauthorized: master key is required
1 | myapp | at promiseEnforceMasterKeyAccess(/home/jaime / production / source / node_modules / parse - server / lib / middlewares.js: 297: 17)
1 | myapp | at / home / jaime / production / source / node_modules / parse - server / lib / PromiseRouter.js: 132: 22
1 | myapp | at process._tickDomainCallback(internal / process / next_tick.js: 129: 7)

You can turn on additional logging by configuring VERBOSE=1 in your environment.

Possibly related to #3022

Just in case you doubt about the installation requests with

 "method": "POST",
    "url": "/parse/classes/

    "x-parse-client-key":

Works just fine

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