Skip to content

Commit 2526ca5

Browse files
committed
feat(server:auth): add role to signToken
add role as second parameter, and attach to jwt closes #382
1 parent 661de88 commit 2526ca5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/templates/server/auth(auth)/auth.service.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ function hasRole(roleRequired) {
7171
/**
7272
* Returns a jwt token signed by the app secret
7373
*/
74-
function signToken(id) {
75-
return jwt.sign({ _id: id }, config.secrets.session, {
74+
function signToken(id, role) {
75+
return jwt.sign({ _id: id, role: role }, config.secrets.session, {
7676
expiresInMinutes: 60 * 5
7777
});
7878
}

0 commit comments

Comments
 (0)