I’m trying to login a user from a cloud function. The idea is to return a session token and then have the client use PFUser.become
. According to the documentation for getSessionToken
should work if using the master key:
Returns the session token for this user, if the user has been logged in, or if it is the result of a query with the master key. Otherwise, returns undefined.
But this doesn’t seem to work. It still returns undefined
using the following code:
const user = await new Parse.Query(User)
.equalTo('username', phoneNumber)
.first({ useMasterKey: true })
console.log('user', user, user.getSessionToken())
Similarly trying to call login without a username or password fails:
await user.logIn({ useMasterKey: true })
I could set a new password and login that way, but it feels like there should be a better solution?