Skip to content

This plugin makes it easy to authenticate via HTTP Basic Auth.

Notifications You must be signed in to change notification settings

use-init/hapi-init-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

HAPI INIT - Authentication Plugin

This plugin makes it easy to authenticate via HTTP Basic Auth.

Usage

Install via npm:

$ npm install --save hapi-init-auth

Require authentication:

// Configure users, can be multiple: Template code here.
const users = {
  {{username}}: {
    username: '{{username}}',
    password: '{{encryted password}}',
    name: '{{name}}',
    id: '{{id}}'
  }
};

const Auth = require('hapi-init-auth');

// In HAPI registration
server.register([], (error) => {
  if (error) {
    throw error;
  }

  server.auth.strategy('simple', 'basic', {
    validateFunc: new Auth(users)
  });
});

About

This plugin makes it easy to authenticate via HTTP Basic Auth.

Resources

Stars

Watchers

Forks

Packages

No packages published