diff --git a/lib/index.js b/lib/index.js index bfcb715..54b33b7 100644 --- a/lib/index.js +++ b/lib/index.js @@ -61,6 +61,9 @@ function noQsMethod(options) { return onError({message: 'invalid token datatype'}, 'invalid_token'); } + // Store encoded JWT + socket[options.encodedPropertyName] = token; + var onJwtVerificationReady = function(err, decoded) { if (err) { @@ -105,7 +108,7 @@ function noQsMethod(options) { } function authorize(options, onConnection) { - options = xtend({ decodedPropertyName: 'decoded_token' }, options); + options = xtend({ decodedPropertyName: 'decoded_token', encodedPropertyName: 'encoded_token' }, options); if (!options.handshake) { return noQsMethod(options); @@ -167,6 +170,9 @@ function authorize(options, onConnection) { return auth.fail(error, data, accept); } + // Store encoded JWT + socket[options.encodedPropertyName] = token; + var onJwtVerificationReady = function(err, decoded) { if (err) {