Skip to content

Commit

Permalink
fix wrong error when setting expiration on non-object payload. closes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
jfromaniello committed Feb 16, 2016
1 parent ae13271 commit 7f7d76e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ JWT.sign = function(payload, secretOrPrivateKey, options, callback) {
options.expiresInSeconds;

payload.exp = timestamp + expiresInSeconds;
} else if (typeof options.expiresIn !== 'undefined') {
} else if (typeof options.expiresIn !== 'undefined' && typeof payload === 'object') {
payload.exp = timespan(options.expiresIn);
if (typeof payload.exp === 'undefined') {
throw new Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60');
Expand Down

0 comments on commit 7f7d76e

Please sign in to comment.