mirror of
https://github.com/Thream/socketio-jwt.git
synced 2024-07-21 09:38:31 +02:00
Merge pull request #106 from Root-Core/patch-1
Fix authentication for namespaces #95
This commit is contained in:
commit
99177e4344
@ -137,6 +137,7 @@ function authorize(options, onConnection) {
|
||||
|
||||
return function(socket, accept){
|
||||
var token, error;
|
||||
var handshake = data.handshake;
|
||||
var req = socket.request || socket;
|
||||
var authorization_header = (req.headers || {}).authorization;
|
||||
|
||||
@ -157,8 +158,11 @@ function authorize(options, onConnection) {
|
||||
}
|
||||
}
|
||||
|
||||
//get the token from query string
|
||||
if (req._query && req._query.token) {
|
||||
//get the token from handshake or query string
|
||||
if (handshake && handshake.query.token){
|
||||
token = handshake.query.token;
|
||||
}
|
||||
else if (req._query && req._query.token) {
|
||||
token = req._query.token;
|
||||
}
|
||||
else if (req.query && req.query.token) {
|
||||
|
Loading…
Reference in New Issue
Block a user