parse-community / parse-community/parse-server

Session token missing while creating new user.

Open
#8,477 13 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

type:bug
Dominant language
JavaScript
Stars
21.4k
Forks
4.8k
Avg merge
7h 45m
Merged PRs (30d)
11

Description

Issue Description

On creating a new user session token is missing. Below are the steps to reproduce.

package.json

{
  "name": "parse-server-error",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.18.2",
    "http": "^0.0.1-security",
    "parse-server": "6.1.0-alpha.7"
  }
}

app.js

const express = require('express');
const http = require('http');
const { ParseServer } = require('parse-server');

const app = express();
const server = http.createServer(app);

const parseServerOption = {
  databaseURI: 'mongodb://mongo:27017/test',
  appId: 'myAppId',
  masterKey: 'myMasterKey',
  serverURL: 'http://localhost:9000/api/parse',
}


async function start() {
  const parseServer = new ParseServer(parseServerOption);
  await parseServer.start();
  app.use('/api/parse', parseServer.app);
  server.listen(9000, '0.0.0.0', async () => {
    console.log('>>>>server running');
    const user = new Parse.User();
    await user.save({ username: 'test', password: 'test' }, { useMasterKey: true });
    console.log('>>>>userId:', user.id, '\tsessionToken:', user.getSessionToken());
  });
}

start();

Start Server

node -v
v16.16.0
npm -v
8.11.0
node app.js

Output

warn: DeprecationWarning: The Parse Server option 'allowClientClassCreation' default will change to 'false' in a future version.
warn: DeprecationWarning: The Parse Server option 'allowExpiredAuthDataToken' default will change to 'false' in a future version.
>>>>server running
>>>>userId: yzNE1MbWh6  sessionToken: undefined

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior using the app.js example and the versions in package.json, then trace how Parse.User.save is handled when useMasterKey is enabled. Confirm the expected session-token behavior and identify the relevant Parse Server tests or entry point before changing anything; done means the reproduced user creation returns the expected session token without breaking existing authentication behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
express, javascript, mongodb, node.js
Domain
api, authentication, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.