parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

User has become invalid after parse server restarted

Open kosumi opened this issue 10 years ago • 4 comments

I confirmed that the user which signed up via cloud code could access all cloud function and objects, even after it logged out and logged in again with renewing its session token.

But after restarting the parse server, all users seem to be invalid. Though an user can log in the server and get a new session after the server restarted , the server responds "unauthorized" when the user calls any cloud code like "query.find". (query.find fails in spite of being passed the new session token explicitly)

I cannot restart the server? or need any options? Of course, this does not occur with Parse.com, although I don't know if Parse.com restarts or not.

kosumi avatar Feb 05 '16 06:02 kosumi

Though I forgot to mention which API I used, it was REST API. Then I checked RestQuery.js. getUserAndRoleACL() seems only to get role and not to try to get the user. Is this the right way? Auth.js seems to get user from cache first. So, I think, my server could retrieve users info and their roles while there were users info in the cache. Then the user could execute cloud code. But after my server was restarted, there were no longer users info in cache, and RestQuery did not retrieve users info. Then the user could not execute cloud code.

kosumi avatar Feb 05 '16 19:02 kosumi

getUserAndRoleACL fetches the array of roles, and then pushes the users objectId on to it. That looks correct.

But this does sound like an issue.. will look in to it.

gfosco avatar Feb 05 '16 19:02 gfosco

When there are no users in cache, user object is got by executing RestQuery.execute. getUserAndRoleACL() is called at first but there is no user object in auth at this time. Then roles are not retrieved.

kosumi avatar Feb 06 '16 04:02 kosumi

Should be fixed by #374 which will be in 2.1.3, or you can pull the latest master. Please open a new issue if you still have problems. Thanks.

gfosco avatar Feb 20 '16 02:02 gfosco