diff --git a/lib/index.js b/lib/index.js index 9519a95..1a74e1d 100644 --- a/lib/index.js +++ b/lib/index.js @@ -63,6 +63,9 @@ function noQsMethod(options) { return onError({message: 'invalid token datatype'}, 'invalid_token'); } + // Store encoded JWT + socket[options.encodedPropertyName] = data.token; + var onJwtVerificationReady = function(err, decoded) { if (err) { @@ -107,7 +110,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); @@ -169,6 +172,9 @@ function authorize(options, onConnection) { return auth.fail(error, data, accept); } + // Store encoded JWT + data[options.encodedPropertyName] = token; + var onJwtVerificationReady = function(err, decoded) { if (err) {