created API For Aplication Absensi
This commit is contained in:
15
app/helpers/token.js
Normal file
15
app/helpers/token.js
Normal file
@@ -0,0 +1,15 @@
|
||||
const jwt = require('jsonwebtoken');
|
||||
const dotenv = require('dotenv');
|
||||
dotenv.config();
|
||||
|
||||
module.exports = {
|
||||
createToken: (payload) => {
|
||||
return jwt.sign(payload, process.env.JWT_SECRET_KEY, {
|
||||
expiresIn: '1d',
|
||||
});
|
||||
},
|
||||
|
||||
validateToken: (token) => {
|
||||
return jwt.verify(token, process.env.JWT_SECRET_KEY);
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user