diff --git a/.eslintrc.json b/.eslintrc.json index d1038cb0..8bd8ef46 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -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": { diff --git a/services/auth/auth.js b/services/auth/auth.js index a9f786e5..ede8219d 100644 --- a/services/auth/auth.js +++ b/services/auth/auth.js @@ -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) {