2
1
mirror of https://github.com/Thream/socketio-jwt.git synced 2024-07-21 09:38:31 +02:00

Merge pull request #158 from ansien12/patch-1

Add a check to make sure provided secret is a string.
This commit is contained in:
Conrad Sopala 2019-08-09 16:50:23 +02:00 committed by GitHub
commit 3128fdfee2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -111,6 +111,10 @@ function noQsMethod(options) {
function authorize(options, onConnection) {
options = xtend({ decodedPropertyName: 'decoded_token', encodedPropertyName: 'encoded_token' }, options);
if (typeof options.secret !== 'string') {
throw new Error(`Provided secret "${options.secret}" is invalid, must be of type string.`)
}
if (!options.handshake) {
return noQsMethod(options);