Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

hapi plugin adding the "request.user" shortcut for "request.auth.credentials"

License

Notifications You must be signed in to change notification settings

futurestudio/hapi-request-user

Repository files navigation

hapi-request-user logo

hapi plugin that shortcuts "request.auth.credentials" to "request.user"


Installation · Usage ·



Build Status hapi-request-user Version Monthly downloads

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:

{
 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:

npm i hapi-request-user

Usage

Register the hapi-request-user plugin and you’re done:

await server.register({
 plugin: require('hapi-request-user'),
})

Feature Requests

Do you miss a feature? Please don’t hesitate to create an issue with a short description of your desired addition to this plugin.

Links & Resources

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


futurestud.io · GitHub @futurestudio · Twitter @futurestud_io

About

hapi plugin adding the "request.user" shortcut for "request.auth.credentials"

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 5

AltStyle によって変換されたページ (->オリジナル) /