Bragg middleware for AWS Cognito Userpool triggers
AWS Cognito Userpools uses different triggers to customize the authentication flow. The bragg-cognito-idp
middleware for bragg provides 3 triggers that are essential for a custom implementation of the authentication flow.
- Define Auth Challenge trigger
- Create Auth Challenge trigger
- Verify Auth Challenge trigger
$ npm install bragg-cognito-idp
const app = require('bragg');
const router = require('bragg-router');
const cognito = require('bragg-cognito-idp');
router.post('idp:DefineAuthChallenge', ctx => {
ctx.body = ctx.request.body
});
router.post('idp:CreateAuthChallenge', ctx => {
ctx.body = ctx.request.body
});
router.post('idp:VerifyAuthChallengeResponse', ctx => {
ctx.body = ctx.request.body
});
app.use(cognito());
app.use(router.routes());
exports.handler = app.listen();
Install the cognito
middleware.
MIT © Simon Jang