Parse.com - How to log in as a user without knowing the password?

I use Parse.com and I like it.

I want the users of my application to be automatically assigned an account (which I create behind the scenes using the API), and then register them in my account.

I could easily do this if I assigned them a hard, standard password for my account, for example, superPass123.

Is this the only way to do this? Or is there another way to allow me to automatically log in as a user without knowing the user password if my user has "super" rights?

+6
source share
1 answer

If you provide enough of it, you can do it using Cloud Code. I will skip the verification / authorization part and focus on how.

A cloud function that, while working with the primary key, can request the user. The cloud function returns the user's session token to the client (user.getSessionToken ()), which uses the become function to log in as that user.

Relevant posts:

Declare the "become" function: http://blog.parse.com/2013/12/03/bring-your-own-login/

Tutorial on implementing cloud code providing a session token: https://parse.com/tutorials/adding-third-party-authentication-to-your-web-app

+7
source

Source: https://habr.com/ru/post/971784/


All Articles