Serverless authentication components for React
$ yarn add react-serverless-auth
or
$ npm install --save react-serverless-auth
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.
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_ID
REACT_APP_COGNITO_CLIENT_ID
The authentication endpoint URLs are configurable and the following default values are pre-defined in
src/routes.js:
REACT_APP_AUTH_LOGIN_URL=/auth/login
REACT_APP_AUTH_CONFIRM_URL=/auth/confirm
REACT_APP_AUTH_REGISTER_URL=/auth/register
REACT_APP_AUTH_RESET_URL=/auth/reset
See CONTRIBUTING.md.