Skip to content

Authentication backend for Firebase Integration

Notifications You must be signed in to change notification settings

ubbn/aws-cdk-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Firebase JWT Handler

This project builds a cloud backend stack in AWS using Golang CDK for handling requests containing Firebase JWT tokens. A part of or entire codebase of the project can be used as a reference for building serverless authentication system in AWS that uses Firebase Authentication in Go programming language.

Resource Topology

The stack provisions following AWS resources:

Resource topology in stack

Flow in Stack

  • API Gateway recieves requests, also it terminates TLS and guards its backend with custom throttling. It forwards the request to authorizer function and responds back to API caller.
  • Lambda authorizer function validates authenitcation token in request's header. And
  • Lambda function processes the valid requests and writes content of token into DynamoDB, and sends notification email to owner of the token.

Prepare for development

Prerequisites tools

For developing and deploying resources in the project, you will need following prerequisites:

Install dependencies

  • go mod download
  • go get

Configure AWS environment

This CDK stack is deployed to AWS environment which is setup in local AWS configuration. For more details about environment configuration, refer to AWS official guide on Environments for the AWS CDK

Development

Deploy the stack

  • cdk bootstrap bootstrap stack, only run once at first time
  • cdk deploy deploy this stack to AWS, run whenever code changes

Other useful commands

  • cdk diff compare deployed stack with current state
  • cdk destroy clean up provisioned AWS resources
  • cdk synth emits the synthesized CloudFormation template
  • go test run unit tests

Troubleshoot

# Deploy the stack in hot-swap for live updates in case of code changes 
cdk watch

# Send a request and monitor its live logs from watch command's output
curl -X POST  https://9h3r3yi8mh.execute-api.eu-west-1.amazonaws.com/  --header "Authorization: Bearer abcdefgh"

Releases

No releases published

Packages

No packages published

Languages