hapi plugin that shortcuts “request.auth.credentials” to “request.user”
Installation · Usage ·
Follow @marcuspoehls for updates!
Development of this hapi plugin is supported by Future Studio University 🚀
Join the Future Studio University and Skyrocket in Node.js
A hapi plugin that shortcuts access to the authenticated user from request.auth.credentials to request.user.
Access the authenticated user in request lifecycle methods, like this:
{
method: 'GET',
path: '/authenticated-user',
handler: (request, h) => {
return request.user // instead of "request.auth.credentials"
}
}hapi v17 and Node.js v8 (or newer)
This plugin requires hapi v17 (or later) and uses async/await which requires Node.js v8 or newer.
Add hapi-request-user as a dependency to your project:
npm i hapi-request-userRegister the hapi-request-user plugin and you’re done:
await server.register({
plugin: require('hapi-request-user'),
})Do you miss a feature? Please don’t hesitate to create an issue with a short description of your desired addition to this plugin.
- hapi tutorial series with 100+ tutorials
- Create a fork
- Create your feature branch:
git checkout -b my-feature - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin my-new-feature - Submit a pull request 🚀
MIT © Future Studio
futurestud.io · GitHub @futurestudio · Twitter @futurestud_io