Go IAM Examples

September 19, 2025 ยท View on GitHub

โœ… Admin UI: go-iam-ui
๐Ÿณ Docker Setup: go-iam-docker
๐Ÿ” Backend: go-iam
๐Ÿ“ฆ SDK: go-iam-sdk
๐Ÿš€ Examples: go-iam-examples ๐Ÿ’ฌ Reddit Community: r/GoIAM

This repository contains examples demonstrating how to integrate Go IAM authentication into applications using different programming languages and frameworks.

Overview

Go IAM is a comprehensive Identity and Access Management solution. This repository provides practical examples showing how to:

  • Authenticate users with JWT tokens
  • Validate tokens using the Go IAM SDK
  • Retrieve user information
  • Implement protected routes and middleware
  • Handle authentication errors

Available Examples

๐ŸŸข Golang

Status: โœ… Available
Framework: Fiber v2
Location: /golang

A complete example showing:

  • JWT authentication middleware
  • User information retrieval
  • Protected HTTP endpoints
  • HTTP client for testing

Quick Start: Navigate to the golang directory and follow the README for detailed setup instructions.

๐ŸŸข Node.js

Status: โœ… Available
Framework: Express.js
SDK: @goiam/typescript
Location: /nodejs

A complete example showing:

  • Official Go IAM SDK integration
  • Express.js authentication middleware
  • Type-safe JWT token validation
  • RESTful API endpoints
  • Modern async/await patterns

Quick Start: Navigate to the nodejs directory and follow the README for detailed setup instructions.

๐ŸŸข TypeScript

Status: โœ… Available
Framework: Express.js
SDK: @goiam/typescript
Location: /typescript

A complete example showing:

  • Full TypeScript support with strict type checking
  • Official Go IAM SDK integration with type safety
  • Strongly typed Express.js server and HTTP client
  • Environment variable configuration
  • Advanced TypeScript patterns and interfaces

Quick Start: Navigate to the typescript directory and follow the README for detailed setup instructions.

๐ŸŸข Python

Status: โœ… Available
Framework: FastAPI
SDK: goiam-python (v0.0.1)
Location: /python

A complete example showing:

  • FastAPI framework with dependency injection
  • Official Go IAM SDK integration for Python
  • Virtual environment setup with automated scripts
  • Type hints and comprehensive error handling
  • Interactive API documentation with Swagger UI
  • Comprehensive testing and setup validation

Quick Start: Navigate to the python directory and run ./setup.sh for automated setup, or follow the README for manual setup instructions.


Coming Soon

We're working on examples for additional languages and frameworks:

๐ŸŸก Java

Status: ๐Ÿšง In Development
Framework: Spring Boot
Expected: Q2 2025


Prerequisites

Before using any example, ensure you have:

  1. Go IAM Server: Set up and running

  2. Development Environment:

    • Appropriate runtime for your chosen language
    • Package manager (go mod, npm, pip, etc.)
  3. Valid Credentials:

    • Client ID and Client Secret from Go IAM
    • Access to Go IAM login interface

General Usage Pattern

All examples follow a similar pattern:

  1. Setup Go IAM Server - Use Docker setup
  2. Configure Credentials - Update client ID/secret in example code
  3. Obtain JWT Token - Login via Go IAM web interface and extract token from browser storage
  4. Run Server - Start the example application server
  5. Test Client - Use provided client code to test authentication

Project Structure

go-iam-examples/
โ”œโ”€โ”€ README.md                 # This file - main documentation
โ”œโ”€โ”€ golang/                   # Golang examples
โ”‚   โ”œโ”€โ”€ README.md            # Golang-specific documentation
โ”‚   โ”œโ”€โ”€ main.go              # Main server application
โ”‚   โ”œโ”€โ”€ client/              # HTTP client examples
โ”‚   โ””โ”€โ”€ go.mod               # Dependencies
โ”œโ”€โ”€ nodejs/                   # Node.js examples
โ”‚   โ”œโ”€โ”€ README.md            # Node.js-specific documentation
โ”‚   โ”œโ”€โ”€ server.js            # Express.js server application
โ”‚   โ”œโ”€โ”€ client/              # HTTP client examples
โ”‚   โ””โ”€โ”€ package.json         # Dependencies and scripts
โ”œโ”€โ”€ typescript/               # TypeScript examples
โ”‚   โ”œโ”€โ”€ README.md            # TypeScript-specific documentation
โ”‚   โ”œโ”€โ”€ src/                 # TypeScript source files
โ”‚   โ”‚   โ”œโ”€โ”€ server.ts        # Express.js server with full typing
โ”‚   โ”‚   โ””โ”€โ”€ client/          # HTTP client examples
โ”‚   โ”œโ”€โ”€ dist/                # Compiled JavaScript (after build)
โ”‚   โ”œโ”€โ”€ tsconfig.json        # TypeScript configuration
โ”‚   โ”œโ”€โ”€ package.json         # Dependencies and scripts
โ”‚   โ””โ”€โ”€ .env.example         # Environment variables template
โ”œโ”€โ”€ python/                   # Python examples
โ”‚   โ”œโ”€โ”€ README.md            # Python-specific documentation
โ”‚   โ”œโ”€โ”€ server.py            # FastAPI server application
โ”‚   โ”œโ”€โ”€ client/              # HTTP client examples
โ”‚   โ”œโ”€โ”€ requirements.txt     # Python dependencies
โ”‚   โ”œโ”€โ”€ venv/                # Virtual environment (after setup)
โ”‚   โ””โ”€โ”€ .env.example         # Environment variables template
โ””โ”€โ”€ [future directories]     # Additional language examples

Getting Started

  1. Choose Your Language: Navigate to the appropriate directory
  2. Read the Specific README: Each example has detailed setup instructions
  3. Follow Prerequisites: Ensure Go IAM server is running
  4. Run the Example: Follow the step-by-step guide in each directory

Support and Documentation

Contributing

We welcome contributions! If you'd like to add examples for additional languages or frameworks:

  1. Create a new directory for your language/framework
  2. Follow the existing structure and documentation patterns
  3. Include a comprehensive README with setup instructions
  4. Add your example to this main README

License

This project follows the same license as the Go IAM project. Please refer to the main Go IAM repository for license details.


Note: This repository contains example code for demonstration purposes. For production use, ensure you follow security best practices and review the code according to your specific requirements.