Skip to content

Instantly share code, notes, and snippets.

@manonthemat
Created April 13, 2015 19:12
Show Gist options
  • Save manonthemat/687c5457d09ea0c1235d to your computer and use it in GitHub Desktop.
Save manonthemat/687c5457d09ea0c1235d to your computer and use it in GitHub Desktop.
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