mirror of
https://github.com/Thream/socketio-jwt.git
synced 2024-07-21 09:38:31 +02:00
commit
413161ce38
@ -57,7 +57,9 @@ function noQsMethod(options) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if(!data || typeof data.token !== "string") {
|
var token = options.cookie ? socket.request.cookies[options.cookie] : (data ? data.token : undefined);
|
||||||
|
|
||||||
|
if(!token || typeof token !== "string") {
|
||||||
return onError({message: 'invalid token datatype'}, 'invalid_token');
|
return onError({message: 'invalid token datatype'}, 'invalid_token');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,10 +98,10 @@ function noQsMethod(options) {
|
|||||||
return onError(err, 'invalid_secret');
|
return onError(err, 'invalid_secret');
|
||||||
}
|
}
|
||||||
|
|
||||||
jwt.verify(data.token, secret, options, onJwtVerificationReady);
|
jwt.verify(token, secret, options, onJwtVerificationReady);
|
||||||
};
|
};
|
||||||
|
|
||||||
getSecret(socket.request, options.secret, data.token, onSecretReady);
|
getSecret(socket.request, options.secret, token, onSecretReady);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user