Skip to main content

Overview

The KYC API uses AWS Cognito for user authentication. This guide shows you how to authenticate users and obtain JWT tokens to make API requests.

Cognito Configuration

Staging Environment

  • User Pool ID: us-east-2_oGu06xbPS
  • App Client ID: 2raj3isqgeivk0m4b94858hice
  • Region: us-east-2

Production Environment

  • User Pool ID: us-east-2_L37NAaTbI
  • App Client ID: 17motn53rgao4bk26ojguv0ldu
  • Region: us-east-2

Authentication Flow

  1. User provides username and password
  2. Authenticate with AWS Cognito
  3. Receive ID token (JWT) and Access token
  4. Use ID token in Authorization: Bearer <id_token> header for API requests

Python Authentication

JavaScript/TypeScript Authentication

Complete Authentication Class

Making API Requests

Error Handling

Best Practices

  1. Store Tokens Securely: Never expose tokens in client-side code or logs
  2. Implement Token Refresh: Automatically refresh tokens before they expire
  3. Handle Errors Gracefully: Implement proper error handling for all authentication flows
  4. Use Environment Variables: Store Cognito configuration in environment variables
  5. Validate Tokens: Always verify token validity before making API requests