I'm a little confused about the functionality in Parse Server that talks about anonymous users. I see it referenced in the source code here: https://github.com/ParsePlatform/parse-server/blob/fcfe2a0376658279b2a6df3346c8ab036c977252/src/authDataManager/index.js#L41
I don't really know how to create an anonymous user JUST via the REST API. Is that possible?
The Parse SDKs all use the REST API to manage anonymous users. They are open source, so looking into their implementation might be the best way to learn how to do this through the REST API yourself.
I'll close this since it is not about any issue with Parse Server itself.
You may use Server Fault for questions about managing Parse Server.
For code-level and/or implementation-related questions or technical support, please refer to Stack Overflow.
For others coming to this issue, I found that you can create an anonymous user via the REST API by posting to the /users collection a payload like:
{
"authData": {
"anonymous": {
"id": "abcdef1234"
}
}
}
Response will look like this if this anonymous user hasn't been created before:
{
"objectId": "ednSJrFWjz",
"createdAt": "2016-07-26T19:46:43.321Z",
"username": "nbIuF9d2xnHYLKcUxUbQg5MIF",
"sessionToken": "r:cf21ab1e1e4a3090dae85068be2ca19f"
}
And it will look like this if the user has already been created previously:
{
"objectId": "ednSJrFWjz",
"username": "nbIuF9d2xnHYLKcUxUbQg5MIF",
"authData": {
"anonymous": {
"id": "abcdef1234"
}
},
"createdAt": "2016-07-26T19:46:43.321Z",
"updatedAt": "2016-07-26T19:46:43.321Z",
"ACL": {
"*": {
"read": true
},
"ednSJrFWjz": {
"read": true,
"write": true
}
},
"sessionToken": "r:c3fe195eac911fcf9cc2f9758cac3d66"
}
Most helpful comment
For others coming to this issue, I found that you can create an anonymous user via the REST API by posting to the
/userscollection a payload like:Response will look like this if this anonymous user hasn't been created before:
And it will look like this if the user has already been created previously: