cjambrosi / poc-node-cognito-m2m-auth

POC with the purpose of testing Cognito functionality for Machine To Machine authentication.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

POC: Amazon Cognito Machine To Machine Auth

POC (Proof of Concept) with the purpose of testing Cognito functionality for Machine To Machine authentication.

Cognito is a well-established authentication service from AWS widely used in the market.

Get started

Env. dependencies:

  • Node >= v18
  • Yarn, NPM or PNPM

Install dependencies:

yarn

Copy the .env-sample file and rename it to .env. Enter the required information from your Cognito configuration.

Run dev:

yan dev

Run build:

yarn build

API Examples

Cognito - SignUp:

# Method: POST
# {url}/signup

{
  "email": "jhondoe@email.com",
  "name": "John Doe",
  "password": "****"
}

Cognito - SignIn:

# Method: POST
# {url}/signin

{
  "email": "jhondoe@email.com",
  "password": "****"
}

Create Products:

# Method: POST
# {url}/products
# Headers: authorization - idToken

{
  "id": "1c5da790-b6cf-41a4-8770-9bf8bd3a7b97",
  "name": "Truck 4x4",
  "type": "vehicle"
}

List Products:

# Method: GET
# {url}/products
# Headers: authorization - idToken

References

CognitoIdentityProviderClient

Controlar o acesso a uma API REST usando um grupo de usuários do Amazon Cognito como autorizador

Como verificar um token Web JSON

Exemplos de código do Amazon Cognito usando AWS SDKs

Using Cognito groups to control access to API endpoints

NodeJS (Typescript) Authentication Service with Amazon Cognito User Pools

AWS Cognito Node.JS

Cognito-Express: API Authentication with AWS Congito

Video - Configurando Autenticação com o Amazon Cognito

Video - Implementando Autenticação e Autorização em APIs na AWS | Cognito + OAuth2

About

POC with the purpose of testing Cognito functionality for Machine To Machine authentication.


Languages

Language:TypeScript 98.2%Language:Shell 1.8%