JinlianWang / aws-lambda-authentication-python

Python implementation of four endpoints for authorization code grant type using AWS Cognito and Lambda.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

aws-lambda-authentication-python

This project is to demo how to create a Lambda function in Python which performs user authentication using oAuth Authorization Code grant type through AWS Cognito. The details, such as workflows and sequence diagrams can be found at User authentication through authorization code grant type using AWS Cognito.

The project can be developed locally and deployed to production in AWS. See "Development" and "Deploy" sections for procedures.

Development

Use the following command to hot load any change in Python code.

export FLASK_APP=app.py
export FLASK_ENV=development
flask run

Use IntelliJ "debug ..." to debug and stop at breakpoints.

Deploy

Follow How to deploy a Flask app on AWS Lambda to set up Zappa, the tool that we use in order to deploy code to AWS Lambda. Zappa also sets up API Gateway fronting Lambda function and enables CORS support for Lambda proxy integration.

To deploy to AWS, use the following command to activate virtual environment and deploy changes to AWS.

source .env/bin/activate
zappa deploy dev

About

Python implementation of four endpoints for authorization code grant type using AWS Cognito and Lambda.


Languages

Language:Python 100.0%