-
Notifications
You must be signed in to change notification settings - Fork 81
Login/Logout functions #89
base: master
Are you sure you want to change the base?
Conversation
Change-Id: I33737781061d47e88991dc19dfd8413e66894da2
Change-Id: I40be75c884bf96ef04f465308aa189cd9c209ac4
How are you planning to use this (big picture)? I don't get the point |
So, the problem I was facing was is this: a user arrives on the site unauthenticated and makes a socket.io connection. Some time later they like to log in, username and password are passed along the websocket, and not a http request, so of course it bypasses all of the passport middleware. I can authenticate the user, using the same strategy configured in passport, but now how to you log in their session? You need the same kind of logic that passport.socketio provides, to take the serialized user and access their session and do some work on it in a way that plays nice with passport. So I add this feature. |
It seems to me that using passport in this case doesn't worth (since passport is designed to run on connect/express). You might want to check this other module: |
Well, @jfromaniello, I'm a little mystified why you don't want this feature. Your module's purpose is to make passport accessible from a socket.io callback. The features you have allow a sessions identity to be accessed from a socket.io callback. This code adds the feature to login a user from a socket.io callback... It seemed like a good fit for this module, which is why I contributed it. |
Can you show me an example usage? It is not clear who is going to call this login method |
The app I need this for is here: https://bitbucket.org/dwarburton/nodecode. The idea is that you can join as anonymous, and over your socket.io connection do a login or register operation. |
I'm looking for this feature too. |
Login/Logout
Thanks dwarburt. I forked your version and merged it with the latest version of jfromaniello and tried it out. It works as expected. pefect. I'm now able to login and logout over websocket instead (or in addition) of html request. It's a lot saver and cleaner in my application. |
Login/Logout merge with latest version from jfromaniello
I'd also need this feature.
|
Thanks @Lichtjaeger. That's what I think too. I forked it as well and merged login branch into master. Already working |
These two functions are useful if you want to do authentication by socket.io. The user parameter should be the serialized form of the user (i.e. user._id or what have you).