1.0.9 • Published 5 years ago
@flightstats/auth-js v1.0.9
AuthJS
The express middleware bits for your Airframe app
This module makes it easy to integrate with Airframe auth components
(yarn add @bit/cirium.airframe.core.auth
)
Though there are many different Airframe apps, the way that server-side authentication happens should be the same, and AuthJS is where auth server-side implementation will be housed
Usage
Create a protected route:
const JWTMiddleware = checkJWT();
server.get('/api/protected', JWTMiddleware, (req, res) => {
res.send({
msg: 'your access token was successfully validated!',
});
});
Handle authorization errors:
...
const jwtException = jwtErrorMiddleware();
server.use(jwtException);
Prerequisites
- ExpressJS (https://expressjs.com/)
Installing
Install dependencies using yarn
yarn
Versioning
We use SemVer for versioning.