Minor auth token fix
This commit is contained in:
parent
9a3dbdb5f5
commit
2280fb1d17
2 changed files with 6 additions and 1 deletions
|
|
@ -60,7 +60,9 @@
|
||||||
|
|
||||||
"consistent-return": "off",
|
"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",
|
"parser": "babel-eslint",
|
||||||
"env": {
|
"env": {
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,9 @@ class Auth {
|
||||||
const key = jwt.decode(token).data.timestamp
|
const key = jwt.decode(token).data.timestamp
|
||||||
const secrets = await this.readSecrets()
|
const secrets = await this.readSecrets()
|
||||||
const secret = secrets[key]
|
const secret = secrets[key]
|
||||||
|
if (!secret) {
|
||||||
|
throw { valid: false }
|
||||||
|
}
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
jwt.verify(token, secret, (err, decoded) => {
|
jwt.verify(token, secret, (err, decoded) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue