how would you implement user auth with pushover? #3

joshrtay opened this Issue Feb 1, 2012 · 1 comment


None yet

2 participants

joshrtay commented Feb 1, 2012

using apache smart http you do something like this

<LocationMatch "^/git/public/.*/git-receive-pack$">
AuthType Basic
AuthName "Public Git Repositories on"
AuthUserFile /etc/apache2/conf.d/git.passwd
Require valid-user

I can't figure out how to do the equivalent with pushover?

The username and password don't seem to be sent in the http request.

vote539 commented Jan 7, 2015

Assuming you are using Express, start with running a Basic Auth middleware. If you want to authenticate to your own user database (e.g. Mongoose), it's easy to roll your own Basic Auth middleware (bing it for more info). Then pass the request into Passover as usual. Example (untested):

var Auth = require("http-auth");
var Express = require("express");
var Pushover = require("pushover");

var repos = Pushover("/srv/repos", { /* ... */ });

var app = Express()
    .use(Auth.basic({ /* ... */ }))
    .use(function(req, res, next){
        req.pause(); // see #30
        repos.handle(req, res);

Personally I have my repo server running on a namespace under my main application. If you want to keep the authentication for only your Pushover users, simply put both middlewares under a namespace.

// ...
var app = Express()
    .use("/repos", Auth.basic({ /* ... */ }))
    .use("/repos", function(req, res, next){
        // ...
    .use( /* your other server magic */ )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment