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

Added option to store encoded jwt, default "encoded_token"

This commit is contained in:
Root-Core 2017-04-18 23:31:38 +02:00
parent 90f431741b
commit d340c81fd5

View File

@ -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) {