You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
350 B
JavaScript
25 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';
|
|
}
|
|
},
|
|
};
|