Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud code hook for user login #1016

Closed
zhouhao27 opened this issue Mar 14, 2016 · 2 comments
Closed

Cloud code hook for user login #1016

zhouhao27 opened this issue Mar 14, 2016 · 2 comments

Comments

@zhouhao27
Copy link

I'm able to use beforeSave and afterSave for my Parse.User object so that I can use it to synchronise my existing user database through rest api to my new parse server application. What I'm trying to do is:

  1. Allow user to user Parse Javascript sdk to login/register
  2. To call my existing rest api to login/register
  3. To make the user data in parse server synchronized with my current backend database.

My question is how I can implement a function like beforeLogin?

@zhouhao27
Copy link
Author

Of course, I can write cloud code for this. But then I can't use parse client sdk to login anymore.

@gfosco
Copy link
Contributor

gfosco commented Mar 17, 2016

Looks like you could fork/edit UsersRouter to catch all the user-related calls, and as long as you still persist _User records and return what the client expects, the SDK should still work. I think most of this logic will move to UserController eventually, making it easier to make & inject your own user behaviors.

Alternatively, you could use a combination... a cloud function to login, which returns a sessionToken, and then use the "become" method on the client to inflate that user object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants