Created
April 13, 2015 19:12
-
-
Save manonthemat/687c5457d09ea0c1235d to your computer and use it in GitHub Desktop.
simple token strategy with hapi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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