Minor auth token fix

This commit is contained in:
emad-salah 2019-12-17 14:18:46 +01:00
parent 9a3dbdb5f5
commit 2280fb1d17
2 changed files with 6 additions and 1 deletions

View file

@ -60,7 +60,9 @@
"consistent-return": "off",
"no-shadow": "off"
"no-shadow": "off",
// We're usually throwing objects throughout the API to allow for more detailed error messages
"no-throw-literal": "off"
},
"parser": "babel-eslint",
"env": {

View file

@ -108,6 +108,9 @@ class Auth {
const key = jwt.decode(token).data.timestamp
const secrets = await this.readSecrets()
const secret = secrets[key]
if (!secret) {
throw { valid: false }
}
return new Promise((resolve, reject) => {
jwt.verify(token, secret, (err, decoded) => {
if (err) {