Skip to content

brooksn/koa-hawk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

koa-hawk

Koa hawk authentication middleware

npm version Build Status

Installation

$ npm install koa-hawk

Usage

var koa = require('koa');
var hawk = require('koa-hawk');

var app = koa();

var getCredentials = function (id, callback) {
    var credentials = {
        key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
        algorithm: 'sha256',
        user: 'Steve'
    };
    return callback(null, credentials);
};

app.use(hawk(getCredentials));

app.use(function* (next){
	if (this.hawk.authorized === true) this.response.body = 'Welcome!';
});

app.listen(3000);

About

Koa hawk authentication middleware

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published