From 0edd5ccefaad58a09eed1c58d9b8f1c1f23ba6e8 Mon Sep 17 00:00:00 2001 From: Marshall Thompson Date: Sun, 31 Jul 2016 18:38:01 -0600 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20mix=20options=20when=20signing?= =?UTF-8?q?=20tokens?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #254. --- src/services/token.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/services/token.js b/src/services/token.js index 0fdd3a87..3e7f1b81 100644 --- a/src/services/token.js +++ b/src/services/token.js @@ -116,16 +116,23 @@ export class Service { const secret = this.options.secret; const options = { algorithm, - expiresIn, notBefore, audience, - issuer, jwtid, - subject, noTimestamp, header }; + if (!data.iss) { + options.issuer = issuer; + } + if (!data.sub) { + options.subject = subject; + } + if (!data.exp) { + options.expiresIn = expiresIn; + } + // const data = { // [this.options.idField]: payload[this.options.idField] // };