Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
simple token strategy with hapi
server.register(require('hapi-auth-jwt2'), function(err) {
if (err) {
throw err;
}
server.auth.strategy('token', 'jwt', false, {
key: constants.application.secretKey,
validateFunc: function(decoded, request, callback) {
if (!decoded || !decoded.verified) {
return callback(null, false);
} else {
return callback(null, true);
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment