Skip to content

Commit

Permalink
Merge pull request #113 from coder-mind-project/hotfixes/hotfix-111
Browse files Browse the repository at this point in the history
Converted tokenEmission and tokenDuration to functions - Master integration
  • Loading branch information
allanalves23 authored Nov 22, 2020
2 parents 58d4b54 + 88871c4 commit 6653511
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
6 changes: 2 additions & 4 deletions api/auth/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,10 @@ module.exports = app => {

user.password = null

const now = Math.floor(Date.now() / 1000)

const payload = {
iss: issuer,
iat: tokenEmission,
exp: tokenDuration,
iat: tokenEmission(),
exp: tokenDuration(),
user: {
_id: user._id || user.id,
name: user.name,
Expand Down
4 changes: 2 additions & 2 deletions config/authentication/tokenrules.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const nowInSecs = () => Math.floor(Date.now() / 1000)

module.exports = {
tokenEmission: nowInSecs(),
tokenDuration: nowInSecs() + 60 * 60 * 24 * 10, // 10 days
tokenEmission: () => nowInSecs(),
tokenDuration: () => nowInSecs() + (60 * 60 * 24 * 10), // 10 days
nowInSecs
}
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "master-api",
"version": "1.1.5",
"version": "1.1.6",
"description": "Master api for Coder Mind platform",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 6653511

Please sign in to comment.