@pd-js/cognito-authentication
v1.0.1
Published
cognito authentication - express server side
Downloads
1
Readme
cognito-authentication
cognito authentication - express server side
Install
npm install @pd-js/cognito-authentication
Requirements
Environment variables
COGNITO_DOMAIN_NAME_URL: <conito_base_url>
COGNITO_CLIENT_ID: <clientId>,
COGNITO_LOGIN_RESPONSE_TYPE: <type example: code>,
COGNITO_LOGIN_SCOPE: <scope>,
COGNITO_ID_PROVIDER: <idProvider>,
COGNITO_LOGIN_GRANT_TYPE: <grantType>
Usage
Javascript - Express nodejs
example: in app router
const cognitoAuthentication = require('@pd-js/cognito-authentication')
const router = require('express').Router()
router.get('/login', cognitoAuthentication) // to login
router.get('/test', cognitoAuthentication, (req, res) => { return res.send('server ok')}) // used as middleware
...