How to use the decode function from jwt-simple
Find comprehensive JavaScript jwt-simple.decode code examples handpicked from public code repositorys.
GitHub: naturalcrit/homebrewery
50 51 52 53 54 55 56 57 58 59 60
//Account Middleware app.use((req, res, next)=>{ if(req.cookies && req.cookies.nc_session){ try { req.account = jwt.decode(req.cookies.nc_session, config.get('secret')); //console.log("Just loaded up JWT from cookie:"); //console.log(req.account); } catch (e){} }
297
862
36
+ 9 other calls in file
2 3 4 5 6 7 8 9 10 11 12 13 14 15
const jwt = require('jwt-simple'); const USE_SERVICE_ACCOUNT = Cypress.env('AUTHENTICATE_WITH_SERVICE_ACCOUNT') === 1; const decodeJWT = (token, secret = null) => jwt.decode(token, secret, secret === null); const encodeJWT = (data, secret = 'dummy_secret') => jwt.encode(data, secret); const forgeAccessTokenWithFakeRoles = (token, fakeRoles) => { const accessData = decodeJWT(token);
8
8
6
+ 4 other calls in file
122 123 124 125 126 127 128 129 130 131
self.classname, util.inspect(token))); socket.emit('disconnect'); return; } var jwtPayload = jwt.decode(token, jwtSecret); CacheFactory.getOneUser(jwtPayload.userId, function (err, user) { if (err) { logger.error(err); socket.emit('disconnect');
0
1
1
+ 9 other calls in file
16 17 18 19 20 21 22 23 24 25 26
} = require('../utils/validation'); module.exports.verifyJwt = (token) => { return new Promise(async (resolve, reject) => { try { const id = jwt.decode(token, process.env.JWT_SECRET).id; const user = await User.findOne( { _id: id }, 'email username avatar bookmarks bio fullName confirmed website' );
0
0
1
+ 9 other calls in file
11 12 13 14 15 16 17 18 19 20
token = token.slice(7, token.length); } let payload = undefined; try { payload = jwt.decode(token, secret); if(payload.exp <= moment().unix()) { next(boom.unauthorized('TOKEN HAS EXPIRED')); } }
0
0
1
+ 9 other calls in file
GitHub: Cuivet/api
158 159 160 161 162 163 164 165 166 167 168 169
} return jwt.encode(payload, 'frase secreta'); } const decodeToken = (token) => { const payload = jwt.decode(token, 'frase secreta'); return payload.userId; } async function checkMP(veterinary, person) {
0
0
0
+ 4 other calls in file
181 182 183 184 185 186 187 188 189 190
if(segment.length !=3 ){ return res.status(403).send({message:'InvalidToken'}); }else{ try { var payload = jwt.decode(token,'quijas2453'); await Cliente.findByIdAndUpdate({_id:payload.sub},{ verify:true });
0
0
1
+ 4 other calls in file
jwt-simple.encode is the most popular function in jwt-simple (89 examples)