strongloop / loopback-example-passport

LoopBack example for facebook login
Other
185 stars 134 forks source link

Check if user signed up or logged in #31

Closed qazs closed 7 years ago

qazs commented 9 years ago

How do you check if a user just signed up or logged in, since all successRedirect goes to /auth/account.

ccgdesigns commented 9 years ago

In your express middleware you can check for req.user (this is added by passport) You can also change the successRedirect in the providers.json file to redirect to a different page

mikesparr commented 9 years ago

Similar to this, I tried merging the two examples from loopback-faq-user-management and loopback-example-passport to have a single solution that includes email verification, password reset (other common use cases of authentication). For some reason when I try to recognize the User.afterRemote('create' ... nothing is received in the example passport. It works fine in the faq-user-management.

Does adding passport somehow override the User model and not register create event which is built in?

I'll add a separate ticket but it seemed related to this issue if perhaps you wanted to use remote hooks to do something after a user signs up or logs in.

mikesparr commented 9 years ago

I wrote this with the passport repo to see if the strategies override models of other frameworks like Loopback as well. Appreciate if anyone knows why: https://github.com/jaredhanson/passport-facebook/issues/123