All Projects → br4in3x → golang-cognito-example

br4in3x / golang-cognito-example

Licence: MIT License
Golang example of using AWS Cognito APIs (Register, Login, Verify Phone, Refresh token)

Programming Languages

HTML
75241 projects
go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to golang-cognito-example

Cognito Backup Restore
AIO Tool for backing up and restoring AWS Cognito User Pools
Stars: ✭ 142 (+91.89%)
Mutual labels:  cognito, aws-cognito
Amplify Js
A declarative JavaScript library for application development using cloud services.
Stars: ✭ 8,539 (+11439.19%)
Mutual labels:  cognito, aws-cognito
Warrant
Python library for using AWS Cognito. With support for SRP.
Stars: ✭ 384 (+418.92%)
Mutual labels:  cognito, aws-cognito
cognito-idp
Lightweight AWS Cognito Identity Provider client for Kotlin Multiplatform and Typescript projects.
Stars: ✭ 14 (-81.08%)
Mutual labels:  cognito, aws-cognito
cognito-to-dynamodb-lambda
Copy newly-confirmed users from Cognito to DynamoDB
Stars: ✭ 68 (-8.11%)
Mutual labels:  cognito, aws-cognito
Cognito Express
Authenticates API requests on a Node application by verifying the JWT signature of AccessToken or IDToken generated by Amazon Cognito.
Stars: ✭ 165 (+122.97%)
Mutual labels:  cognito, aws-cognito
Aws Serverless Auth Reference App
Serverless reference app and backend API, showcasing authentication and authorization patterns using Amazon Cognito, Amazon API Gateway, AWS Lambda, and AWS IAM.
Stars: ✭ 724 (+878.38%)
Mutual labels:  cognito, aws-cognito
terraform-aws-cognito-user-pool
Terraform module to create Amazon Cognito User Pools, configure its attributes and resources such as app clients, domain, resource servers. Amazon Cognito User Pools provide a secure user directory that scales to hundreds of millions of users.
Stars: ✭ 65 (-12.16%)
Mutual labels:  cognito, aws-cognito
aws-amplify-react-custom-ui
Building a Custom UI Authentication For AWS Amplify
Stars: ✭ 21 (-71.62%)
Mutual labels:  cognito, aws-cognito
soto-cognito-authentication-kit
Authenticating with AWS Cognito
Stars: ✭ 20 (-72.97%)
Mutual labels:  cognito, aws-cognito
laravel-docker-redis
Simple example: How to use laravel and redis using docker compose
Stars: ✭ 23 (-68.92%)
Mutual labels:  example
go-wasm-examples
Some small examples of using Go and WebAssembly
Stars: ✭ 22 (-70.27%)
Mutual labels:  example
node-opencv-templatematching-test
Test for template matching using node-opencv
Stars: ✭ 20 (-72.97%)
Mutual labels:  example
Object-Detection-Using-YOLO-v2-Deep-Learning
MATLAB example of deep learning based object detection using Yolo v2 with ResNet50 Base Network
Stars: ✭ 34 (-54.05%)
Mutual labels:  example
match stream
A sample project to show in our scale blog post
Stars: ✭ 30 (-59.46%)
Mutual labels:  example
lagom-samples
developer.lightbend.com/start/?group=lagom
Stars: ✭ 85 (+14.86%)
Mutual labels:  example
cypress-example-docker-compose
Example running Cypress tests against Apache server via docker-compose
Stars: ✭ 106 (+43.24%)
Mutual labels:  example
tensorflow flask
tensorflow model deployment in flask REST API
Stars: ✭ 26 (-64.86%)
Mutual labels:  example
djcra
Django ❤️ create-react-app integration example
Stars: ✭ 12 (-83.78%)
Mutual labels:  example
discord-giveaways-bot
🎁Giveways Bot using the discord-giveaways package
Stars: ✭ 118 (+59.46%)
Mutual labels:  example

Golang AWS Cognito Register, Verify phone number, Login and Get User example

Just Show Me

If you are just curious how things work all together, you can find this example working at https://golang-cognito-example.herokuapp.com

Instructions

This example code demonstrates how to use AWS Cognito with AWS Go SDK in a form of simple web pages where you can:

  1. Check if username is taken
  2. Register
  3. Verify user's phone
  4. Login with username or refresh token

In order this solution to work, you need to have AWS credentials configured (file .aws/configuration exists) and User Pool created in AWS Console. You have to disable "Remember device" and enable "Sms second-factor" on authentication tab.

When the app client is created, in it's settings select "Enable username-password (non-SRP) flow for app-based authentication (USER_PASSWORD_AUTH)".

It's possible to use go sdk with client secret. You can read a bit more about generating client secrets here: https://dev.to/mcharytoniuk/using-aws-cognito-app-client-secret-hash-with-go-8ld

Build

go build -o ./build/cognito

Run

Without client secret:

AWS_PROFILE=XXX COGNITO_APP_CLIENT_ID=XXX COGNITO_USER_POOL_ID=XXX PORT=8080 ./build/cognito

With client secret:

AWS_PROFILE=XXX COGNITO_APP_CLIENT_ID=XXX COGNITO_APP_CLIENT_SECRET=XXX  COGNITO_USER_POOL_ID=XXX PORT=8080 ./build/cognito

It's worth noting that in production environment you should not pass client secrets this way because with adequate permissions it's possible to read environmental variables of a running process. Also if you call a command that way, secret hash will be stored in your shell history. You should keep those issues in mind and mitigate them in your enviroment.

Visit http://localhost:8080/ to see the list of available pages.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].