parse-community / parse-community/parse-server
`authData` is reset on save for newly created anonymous user
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 21.4k
- Forks
- 4.8k
- Avg merge
- 7h 45m
- Merged PRs (30d)
- 11
Description
New Issue Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
- I can reproduce the issue with the latest version of Parse Server.
Issue Description
authData is reset for newly created anonymous users, if I just save it right after creating.
Steps to reproduce
To reproduce the issue use this cloud code. It's minimal artificial example, but it shows the problem:
const user = await Parse.AnonymousUtils.logIn()
await user.save(null, { useMasterKey: true })
But there is workaround to keep authData in place:
const user = await Parse.AnonymousUtils.logIn()
await user.save('authData', {}, { useMasterKey: true })
in this case it's not overwritten by empty object, and keeps original value.
Actual Outcome
authData should be saved to DB
Expected Outcome
authData is undefined in DB
Failing Test Case / Pull Request
- 🤩 I submitted a PR with a fix and a test case.
- 🧐 I submitted a PR with a failing test case.
Environment
Server
- Parse Server version:
4.5.0 - Operating system:
OS X Bug Sur 11.2.1 - Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc):
local and remote Heroku
Database
- System (MongoDB or Postgres):
MongoDB - Database version:
4.4.6 - Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc):
MongoDB Atlas
Client
- SDK (iOS, Android, JavaScript, PHP, Unity, etc):
JavaScript - SDK version:
2.17.0
Logs
no logs
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with Parse.AnonymousUtils.logIn followed by user.save(null, { useMasterKey: true }), then compare it with the workaround that explicitly saves authData. Trace how the Parse Server save path handles authData for newly created anonymous users; done means the original authData remains persisted after the immediate save.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mongodb, node.js
- Domain
- authentication, backend, database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100