1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 21:29:43 +02:00
planka/server/api/helpers/utils/verify-token.js

24 lines
350 B
JavaScript

const jwt = require('jsonwebtoken');
module.exports = {
sync: true,
inputs: {
token: {
type: 'string',
required: true,
},
},
exits: {
invalidToken: {},
},
fn(inputs) {
try {
return jwt.verify(inputs.token, sails.config.session.secret);
} catch (error) {
throw 'invalidToken';
}
},
};