React Authentication Components using AWS Cognito
Installation
$ yarn add react-serverless-author$ npm install --save react-serverless-auth
Configuration
To simplify the integration with create-react-app the package uses environment variables as described in the create-react-app documentation. The environment variables are handled using dotenv by default.
Amazon Cognito User Pool
To use the react-serverless-auth components you need to create an Amazon Cognito User Pool from the AWS Console for Cognito User Pools or using the create-user-pool command in the AWS CLI.
IMPORTANT: When creating the App, the generate client secret box must be unchecked because the JavaScript SDK doesn't support apps that have a client secret.
The User Pool ID and Client ID are specified in the following environment variables:
REACT_APP_COGNITO_USER_POOL_IDREACT_APP_COGNITO_CLIENT_ID
Authentication URLs
The authentication endpoint URLs are configurable and the following default values are pre-defined in src/routes.js:
REACT_APP_AUTH_LOGIN_URL=/auth/loginREACT_APP_AUTH_CONFIRM_URL=/auth/confirmREACT_APP_AUTH_REGISTER_URL=/auth/registerREACT_APP_AUTH_RESET_URL=/auth/reset
Contributing
See CONTRIBUTING.md.