1.1.1 • Published 6 years ago
@remap/authenticate-middleware v1.1.1
authenticate-middleware
yarn add @remap/authenticate-middleware
Usage
const compose = require('micro-compose')
const { handleErrors } = require('micro-errors')
const authenticateMiddleware = require('@remap/authenticate-middleware')
module.exports = compose(
handleErrors(),
authenticateMiddleware(),
)(
async (req, res) => {
// req.auth
// {
// name: string;
// picture: string;
// auth_time: number;
// email: string;
// email_verified: boolean;
// uid: string;
// }
}
)
Optional custom authenticator
const middleware = authenticateMiddleware({
authenticate: async () => await doSomething(),
})