Skip to content
This repository has been archived by the owner on Mar 22, 2022. It is now read-only.

Don’t mix options when signing tokens #255

Merged
merged 1 commit into from
Aug 9, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/services/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confused a bit about this one @marshallswain. Maybe I'm missing something. Any reason you want to pass those as data?

I was thinking any token options should come from params.jwt and due to the object deconstruction above this, those fields will just be undefined if they weren't passed along via params.jwt or aren't a default value.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are already getting passed when you login with a token, which is
causing an error.
On Wed, Aug 3, 2016 at 8:37 PM Eric Kryski notifications@github.com wrote:

In src/services/token.js
#255 (comment)
:

   noTimestamp,
   header
 };
  • if (!data.iss) {

Confused a bit about this one @marshallswain
https://github.com/marshallswain. Maybe I'm missing something. Any
reason you want to pass those as data?

I was thinking any token options should come from params.jwt and due to
the object deconstruction above this, those fields will just be undefined
if they weren't passed along via params.jwt or aren't a default value.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/feathersjs/feathers-authentication/pull/255/files/0edd5ccefaad58a09eed1c58d9b8f1c1f23ba6e8#r73454675,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAH3WX6lz5v2EhvQ22Kq6UcSkcWEmFB8ks5qcVBZgaJpZM4JZKVM
.

Copy link
Member

@ekryski ekryski Aug 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. Ok cool. :shipit:

options.issuer = issuer;
}
if (!data.sub) {
options.subject = subject;
}
if (!data.exp) {
options.expiresIn = expiresIn;
}

// const data = {
// [this.options.idField]: payload[this.options.idField]
// };
Expand Down