Using everyauth with recovery

I am trying to use everyauth for authentication for rest api created with reify. But can not find a starting point. I would expect to do something like:

var restify = require('restify'); var everyauth = require('everyauth'); var server = restify.createServer(); server.use(everyauth.middleware()); 

but recovery does not accept allauth middleware.

How do I configure restify and everyauth?

+4
everyauth restify
source share
1 answer

The problem you are facing is not being restored, and the current one will not have a middleware layer.

Below is the author of the reminder

I thought about this quite a bit, and what bothers me is a subscription to Connect evermore compatibility. I have no control or input for what they decided to do. It seems more like "if it works, great."

I am going to close this with "do not fix": \

https://github.com/mcavage/node-restify/issues/89

What you can do is use connect and add a restify server on top of this, then you can use connect to manage your middleware, such as everyauth.

Here is a great example, I am working perfectly on my system as is.

 // Restify server config here var server = restify.createServer({ name: 'restify-test', version: '1.0.0', }); // ... // Connect config here var connectApp = connect() .use(connect.logger()) .use(connect.bodyParser()) .use(connect.query()) .use(connect.cookieParser()) // And this is where the magic happens .use("/api", function (req, res) { server.server.emit('request', req, res); }); connectApp.listen(8080); 

https://gist.github.com/2140974

Then you can add everyauth to connect according to the docs.

Hope this helps.

+13
source share

All Articles