Express Devise Token Auth (WARNING: Not production ready yet!)
Information
Express Devise Token Auth is a general middleware that adds the ability to express projects authenticate users through a devise-token-auth micro service running with Rails.
Basically this middleware validates token information and acts like a before_action :authenticate_user
that we have in Rails.
Installation
npm install express-devise-token-auth --save
Setup
The setup is pretty straight forward and easy, you just need to:
- Configure customAuth
- Use authentication
Protecting all routes
const app = ;const authentication = ; const customAuth = deviseURL: 'http://localhost:3000' deviseScope: 'v1' deviseFor: 'indicator'; app app; app; moduleexports = app;
Protecting just some routes
const app = ;const authentication = ; const adminRoutes = ; const customAuth = deviseURL: 'http://localhost:3000' deviseScope: 'v1' deviseFor: 'indicator'; app; app; moduleexports = app;