Skip to content

Commit 38d168e

Browse files
committed
Merge pull request auth0#25 from awlayton/master
Allow passing JOSE headers to sign function
2 parents 0a9888f + b82831b commit 38d168e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ module.exports.decode = function (jwt) {
88
module.exports.sign = function(payload, secretOrPrivateKey, options) {
99
options = options || {};
1010

11-
var header = {typ: 'JWT', alg: options.algorithm || 'HS256'};
11+
var header = ((typeof options.headers === 'object') && options.headers) || {};
12+
header.typ = 'JWT';
13+
header.alg = options.algorithm || 'HS256';
1214

1315
if (options.header) {
1416
Object.keys(options.header).forEach(function (k) {

0 commit comments

Comments
 (0)