Skip to content

Querying User with master key is not returning session token #2764

Closed
@techyrajeev

Description

@techyrajeev

Running a cloned repository from parse server example.

https://github.com/ParsePlatform/parse-server-example
I am try to fetch the session token associated with an existing user using master key.
I am providing a user parameter such as email and want to fetch that user with its session token.
My problem is that I am not able to get session token with the user object received. I tried a lot but couldn't figure out what is the problem.

curl -X GET \
  -H "X-Parse-Application-Id: app-id" \
  -H "X-Parse-REST-API-Key: rest-key" \
  -H "X-Parse-MASTER-Key: master-key" \
  -G \
  --data-urlencode 'where={"email":"[email protected]"}' \
  https://herokuapp.com/parse/classes/_User

Server setup:

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 || 'myAppId',
  masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret!
  serverURL: process.env.SERVER_URL',  // Don't forget to change to https if needed
  liveQuery: {
    classNames: ["Posts", "Comments"] // List of classes to support for query subscriptions
  }
});

Steps to reproduce:

Deploy Parse-Server to Heroku.

send curl request

curl -X GET \
  -H "X-Parse-Application-Id: app-id" \
  -H "X-Parse-REST-API-Key: rest-key" \
  -H "X-Parse-MASTER-Key: master-key" \
  -G \
  --data-urlencode 'where={"email":"[email protected]"}' \
  https://herokuapp.com/parse/classes/_User

or

curl -X GET \
  -H "X-Parse-Application-Id: app-id" \
  -H "X-Parse-REST-API-Key: rest-key" \
  -H "X-Parse-MASTER-Key: master-key" \
  https://herokuapp.com/parse/users/user_objectId

Expected Results

The code should run and data related to user along with session token should be present.

Actual Outcome

Data related to user is fetched but without sessionToken associated with user.
There is no sessionToken present.
Environment Setup

Server

express: "^4.14.0",
parse: "^1.9.1",
parse-server: "^2.2.18"

Operating System: Mac Os
Hardware: MacBook Pro
Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): Heroku
Database

MongoDB version: 3.0.12
Storage engine: AWS us-east-1
Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): mLab

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