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

how to authenticate user in the socket.io? #111

Closed
anguskwan opened this Issue Mar 22, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@anguskwan
Copy link

anguskwan commented Mar 22, 2016

i used the https://github.com/jfromaniello/passport.socketio to check whether the user is logined in the server socket.

//With Socket.io >= 1.0
io.use(passportSocketIo.authorize({
  cookieParser: cookieParser,       // the same middleware you registrer in express
  key:          'express.sid',       // the name of the cookie where express/connect stores its session_id
  secret:       'session_secret',    // the session_secret to parse the cookie
  store:        sessionStore,        // we NEED to use a sessionstore. no memorystore please
  success:      onAuthorizeSuccess,  // *optional* callback on success - read more below
  fail:         onAuthorizeFail,     // *optional* callback on fail/error - read more below
}));

how to do with feathers-authentication? thanks.

@ekryski

This comment has been minimized.

Copy link
Member

ekryski commented Mar 22, 2016

@anguskwan while it's possible to use socket.io directly to authenticate with a Feathers server you are better off using the feathers-client for authentication.

At this point we're not looking to support people using third party modules like passportSocketIo as that method relies on sessions. So currently, you are on your own for that. If you want to look at how we set up the socket authentication with Feathers you can check out this function.

@ekryski ekryski closed this Mar 22, 2016

@anguskwan

This comment has been minimized.

Copy link
Author

anguskwan commented Mar 22, 2016

thank you so much for your quick and kind response @ekryski.
i did not mean to use a third party for socket authentication.
what i want is to do double check user info in the server side socket, the setupSocketIOAuthentication code answer my questions.

thanks again.

@ekryski

This comment has been minimized.

Copy link
Member

ekryski commented Mar 22, 2016

@anguskwan awesome 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.