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

Socket.IO With 'authorization' #40

Open
alanjames1987 opened this issue Apr 1, 2014 · 4 comments
Open

Socket.IO With 'authorization' #40

alanjames1987 opened this issue Apr 1, 2014 · 4 comments

Comments

@alanjames1987
Copy link

In order to have Socket.IO and Express share the same session data a sessionStore and cookie have to be used. This works great on browers, but PhoneGap is giving me problems.

I referenced your Socket.IO example and the socket.on('error'... event keeps firing. I looked at my Socket.IO log and this is the error I am getting when PhoneGap tries to connect.

GET /socket.io/1/?t=1396314433839 302 2ms - 82b
   debug - authorized
   warn  - handshake error MISSING_COOKIE

I'm using PhoneGap 3.4.0 on Android 4.2.2 on a Galaxy Nexus.

Do you know how I can fix this?

@mkuklis
Copy link
Owner

mkuklis commented Apr 1, 2014

@alanjames1987 that's strange. I'm using a similar setup here (cookie based auth with express) and things are working fine for me. What version of socket.io-client do you use? Do things work fine for you when testing from the browser?

@alanjames1987
Copy link
Author

I've been using 0.9.6 as the client and server. I've been using socket.io-session to connect my Express and Socket.IO sessions.

From what I can see it looks like PhoneGap just never works with cookies. I might be wrong on this but it looks like I will have to write my own authorization function to handle different requests from browsers or PhoneGap.

This should be no problem, but it's just a drag that PhoneGap didn't behave exactly like browsers do.

@eldyvoon
Copy link

@mkuklis
Copy link
Owner

mkuklis commented Jul 25, 2016

@eldyvoon I would suggest switching from a cookie based auth to a token based.

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

3 participants