Skip to content

This is a robust, serverless authentication service that uses AWS Cognito for handling user authentication. It's built using Serverless Framework, AWS Lambda, and Express.js.

Notifications You must be signed in to change notification settings

otlichnyy/auth-service-serverless

Repository files navigation

Authentication Service

This is a robust, serverless authentication service that uses AWS Cognito for handling user authentication. It's built using Serverless Framework, AWS Lambda, and Express.js.

Features

This service provides the following REST API endpoints for user authentication:

  • /signup - Register a new user
  • /confirm - Confirm a new user registration
  • /resend-confirm - Resend the confirmation code to the user's email
  • /login - Authenticate a user
  • /forgot - Request a user password reset
  • /reset-password - Reset a user's password
  • /refresh - Refresh a user's authentication tokens

Installation

  1. Install Serverless globally
npm install -g serverless
  1. Clone the repository:
git clone https://github.com/otlichnyy/auth-service-serverless.git
cd repo
  1. Install dependencies:
npm install
  1. Deploy the service:
npm run deploy

Usage

The API endpoints can be invoked using any HTTP client like curl or Postman. Here are some examples:

  • Signup
POST /signup
{
    "email": "test@example.com",
    "password": "yourpassword"
}
  • Confirm Signup
POST /confirm
{
    "email": "test@example.com",
    "code": "123456"
}

Running Tests

To run tests, use the following npm script:

npm test

Linting

This service uses ESLint and Prettier for code formatting and consistency. Run the linter with:

npm run lint

Deployment

To deploy this service to your AWS account, you need to set up your AWS credentials either by setting up the AWS CLI or by adding the access key and secret key to a .env file in the root of the project.

Then run:

npm run deploy

Cleanup

To delete the service from your AWS account, run:

npm run destroy

Contributions

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

This is a robust, serverless authentication service that uses AWS Cognito for handling user authentication. It's built using Serverless Framework, AWS Lambda, and Express.js.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published