Skip to content

Wrong number of parameters in signToken method #382

@remicastaing

Description

@remicastaing

The method signToken from auth.service.js is always called with two parameters:

var token = signToken(req.user._id, req.user.role);

(in /app/templates/server/auth(auth)/local/index.js line 15 or in /app/templates/server/auth(auth)/auth.service.js line 68)

But the function just accepts one parameter:

/**
 * Returns a jwt token signed by the app secret
 */
function signToken(id) {
  return jwt.sign({ _id: id }, config.secrets.session, { expiresInMinutes: 60*5 });
}

Where are the informations user.id and user.role extrated out of the token and then used?

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions