https://github.com/futurestudio/hapi-request-user
hapi plugin adding the “request.user” shortcut for “request.auth.credentials”
https://github.com/futurestudio/hapi-request-user
decorates future-studio-university futurestudio hapi hapi-auth hapi-plugin hapijs
Last synced: 4 months ago
JSON representation
hapi plugin adding the “request.user” shortcut for “request.auth.credentials”
- Host: GitHub
- URL: https://github.com/futurestudio/hapi-request-user
- Owner: futurestudio
- License: mit
- Created: 2018-04-03T04:50:22.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-01-26T04:09:38.000Z (about 2 years ago)
- Last Synced: 2025-09-15T15:02:58.501Z (5 months ago)
- Topics: decorates, future-studio-university, futurestudio, hapi, hapi-auth, hapi-plugin, hapijs
- Language: JavaScript
- Homepage:
- Size: 254 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
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
------
## Introduction
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:
```js
{
method: 'GET',
path: '/authenticated-user',
handler: (request, h) => {
return request.user // instead of "request.auth.credentials"
}
}
```
## Requirements
> **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**.
## Installation
Add `hapi-request-user` as a dependency to your project:
```bash
npm i hapi-request-user
```
## Usage
Register the `hapi-request-user` plugin and you’re done:
```js
await server.register({
plugin: require('hapi-request-user'),
})
```
## Feature Requests
Do you miss a feature? Please don’t hesitate to
[create an issue](https://github.com/futurestudio/hapi-request-user/issues) with a short description of your desired addition to this plugin.
## Links & Resources
- [hapi tutorial series](https://futurestud.io/tutorials/hapi-get-your-server-up-and-running) with 100+ tutorials
## Contributing
1. Create a fork
2. Create your feature branch: `git checkout -b my-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request 🚀
## License
MIT © [Future Studio](https://futurestud.io)
---
> [futurestud.io](https://futurestud.io) ·
> GitHub [@futurestudio](https://github.com/futurestudio/) ·
> Twitter [@futurestud_io](https://twitter.com/futurestud_io)