Skip to content

Commit 6653511

Browse files
authored
Merge pull request #113 from coder-mind-project/hotfixes/hotfix-111
Converted tokenEmission and tokenDuration to functions - Master integration
2 parents 58d4b54 + 88871c4 commit 6653511

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

api/auth/auth.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,10 @@ module.exports = app => {
8282

8383
user.password = null
8484

85-
const now = Math.floor(Date.now() / 1000)
86-
8785
const payload = {
8886
iss: issuer,
89-
iat: tokenEmission,
90-
exp: tokenDuration,
87+
iat: tokenEmission(),
88+
exp: tokenDuration(),
9189
user: {
9290
_id: user._id || user.id,
9391
name: user.name,

config/authentication/tokenrules.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const nowInSecs = () => Math.floor(Date.now() / 1000)
22

33
module.exports = {
4-
tokenEmission: nowInSecs(),
5-
tokenDuration: nowInSecs() + 60 * 60 * 24 * 10, // 10 days
4+
tokenEmission: () => nowInSecs(),
5+
tokenDuration: () => nowInSecs() + (60 * 60 * 24 * 10), // 10 days
66
nowInSecs
77
}

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "master-api",
3-
"version": "1.1.5",
3+
"version": "1.1.6",
44
"description": "Master api for Coder Mind platform",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)