Skip to content

Commit

Permalink
ensure that credentials argument is not required in verifyFunc() call…
Browse files Browse the repository at this point in the history
…back as documented. default to `decoded` when not supplied. fixes #187
  • Loading branch information
nelsonic committed Aug 22, 2016
1 parent 48024e1 commit fdcbb76
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ internals.implementation = function (server, options) {

var token = extract(request, options); // extract token from Header, Cookie or Query param

var tokenType = options.tokenType || 'Token'; //
var tokenType = options.tokenType || 'Token'; //

if (!token) {
return reply(raiseError('unauthorized', null, tokenType));
Expand Down Expand Up @@ -107,7 +107,7 @@ internals.implementation = function (server, options) {
else if (!valid) {
return reply(raiseError('unauthorized', 'Invalid credentials', tokenType), null, { credentials: decoded });
} else {
return reply.continue({ credentials: credentials, artifacts: token });
return reply.continue({ credentials: credentials || decoded, artifacts: token });
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion test/verify_func_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var customVerifyFunc = function (decoded, request, callback) {
return callback(new Error('customVerify fails!'));
}
else if (decoded.some_property) {
return callback(null, true, decoded);
return callback(null, true);
}
else {
return callback(null, false, decoded);
Expand Down

0 comments on commit fdcbb76

Please sign in to comment.