Fix token
This commit is contained in:
parent
db480a88e0
commit
3cc66f4e97
2 changed files with 9 additions and 4 deletions
1
.env
1
.env
|
|
@ -6,3 +6,4 @@ DB_USERNAME=recipe-backend
|
|||
DB_PASSWORD=yeshu0bue5aigaphie0eemoFey3farei
|
||||
DB_DATABASE=recipe-backend-dev
|
||||
NODE_ENV=dev
|
||||
JWT_SECRET=m+rQLREpPDTjaiD2nh4IIeu/y9Y5rWB8pyiOTBIgUtRiPpxp4dFeJ9iV1KL7Mfa+ZczvJnZanoXVLWS80lq0wg==
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import * as jwt from "jsonwebtoken";
|
||||
import * as bcrypt from "bcrypt";
|
||||
import * as dotenv from "dotenv";
|
||||
import jwt from "jsonwebtoken";
|
||||
import bcrypt from "bcrypt";
|
||||
import dotenv from "dotenv";
|
||||
|
||||
dotenv.config();
|
||||
const { JWT_SECRET = "" } = process.env;
|
||||
|
|
@ -16,4 +16,8 @@ export class encrypt {
|
|||
// @todo currently, we have an error here!
|
||||
return jwt.sign(payload, JWT_SECRET, { expiresIn: "1d" });
|
||||
}
|
||||
|
||||
static verifyToken(token: string) {
|
||||
return jwt.verify(token, JWT_SECRET);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue