The Go IAM SDK is a comprehensive multi-language library for integrating with the Go IAM server. It provides methods for authentication, user management, and resource creation across multiple programming languages and frameworks.
Available SDKs:
- Go - Server-side applications
- TypeScript - Node.js and browser applications
- Python - Python applications with async support
- Rust - High-performance applications
- React - Frontend React applications with Context, hooks, and components
✅ Admin UI: go-iam-ui
🐳 Docker Setup: go-iam-docker
🔐 Backend: go-iam
📦 SDK: go-iam-sdk
🚀 Examples: go-iam-examples
go get github.com/melvinodsa/go-iam-sdk/golangnpm install @goiam/typescript
# or
pnpm add @goiam/typescript
# or
yarn add @goiam/typescriptpip install goiam-python
# or
poetry add goiam-python
# or
pipenv install goiam-pythonAdd to your Cargo.toml:
[dependencies]
goiam = "0.1.0"
tokio = { version = "1.0", features = ["full"] }npm install @goiam/react
# or
pnpm add @goiam/react
# or
yarn add @goiam/reactimport (
"context"
goiam "github.com/melvinodsa/go-iam-sdk/golang"
)
func main() {
service := goiam.NewService("https://go-iam.example.com", "your-client-id", "your-secret")
// Use the service instance for API calls
}ctx := context.Background()
token, err := service.Verify(ctx, "auth-code")
if err != nil {
log.Fatalf("Failed to verify code: %v", err)
}
fmt.Println("Access Token:", token)user, err := service.Me(ctx, token)
if err != nil {
log.Fatalf("Failed to fetch user information: %v", err)
}
fmt.Printf("User: %+v\n", user)resource := &golang.Resource{
ID: "resource-id",
Name: "Resource Name",
Description: "Resource Description",
Tags: []string{"tag1", "tag2"},
}
err = service.CreateResource(ctx, resource)
if err != nil {
log.Fatalf("Failed to create resource: %v", err)
}
fmt.Println("Resource created successfully")import { GoIamSdk } from "@goiam/typescript";
const sdk = new GoIamSdk(
"https://go-iam.example.com",
"your-client-id",
"your-secret"
);const token = await sdk.verify("auth-code");
console.log("Access Token:", token);const user = await sdk.me(token);
console.log("User:", user);const resource = {
id: "resource-id",
name: "Resource Name",
description: "Resource Description",
key: "resource-key",
enabled: true,
projectId: "project-id",
createdBy: "creator",
updatedBy: "updater",
};
await sdk.createResource(resource, token);
console.log("Resource created successfully");from goiam import new_service
service = new_service(
base_url="https://go-iam.example.com",
client_id="your-client-id",
secret="your-secret"
)try:
token = service.verify("auth-code")
print(f"Access Token: {token}")
except Exception as error:
print(f"Failed to verify code: {error}")try:
user = service.me(token)
print(f"User: {user.name} ({user.email})")
except Exception as error:
print(f"Failed to fetch user information: {error}")from goiam import Resource
resource = Resource(
id="resource-id",
name="Resource Name",
description="Resource Description",
key="resource-key",
enabled=True,
project_id="project-id",
created_by="creator",
updated_by="updater"
)
try:
service.create_resource(resource, token)
print("Resource created successfully")
except Exception as error:
print(f"Failed to create resource: {error}")use goiam::{new_service, Service};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let service = new_service(
"https://go-iam.example.com".to_string(),
"your-client-id".to_string(),
"your-secret".to_string(),
);
// SDK usage here...
Ok(())
}match service.verify("auth-code").await {
Ok(token) => println!("Access Token: {}", token),
Err(error) => eprintln!("Failed to verify code: {}", error),
}match service.me(&token).await {
Ok(user) => println!("User: {} ({})", user.name, user.email),
Err(error) => eprintln!("Failed to fetch user information: {}", error),
}use goiam::Resource;
let resource = Resource::new("resource-id".to_string(), "Resource Name".to_string());
match service.create_resource(&resource, &token).await {
Ok(_) => println!("Resource created successfully"),
Err(error) => eprintln!("Failed to create resource: {}", error),
}import React from "react";
import { GoIamProvider, createGoIamConfig } from "@goiam/react";
const config = createGoIamConfig({
baseUrl: "https://go-iam.example.com",
clientId: "your-client-id",
redirectUrl: "https://your-app.com/callback",
});
function App() {
return (
<GoIamProvider config={config}>
<YourApp />
</GoIamProvider>
);
}import { useGoIam } from "@goiam/react";
function LoginButton() {
const { isAuthenticated, user, login, logout, isLoading } = useGoIam();
if (isLoading) return <div>Loading...</div>;
if (isAuthenticated) {
return (
<div>
<p>Welcome, {user?.name || user?.email}!</p>
<button onClick={logout}>Logout</button>
</div>
);
}
return <button onClick={login}>Login</button>;
}import { AuthGuard } from "@goiam/react";
function ProtectedRoute() {
return (
<AuthGuard requiredRoles={["admin"]} redirectToLogin={true}>
<AdminDashboard />
</AuthGuard>
);
}This repository contains multiple SDK implementations for different languages and frameworks:
go-iam-sdk/
├── golang/ # Go SDK - Server-side applications
├── typescript/ # TypeScript SDK - Node.js and browser
├── python/ # Python SDK - Python applications
├── rust/ # Rust SDK - High-performance applications
└── react/ # React SDK - React applications with hooks and components
Each SDK has its own comprehensive documentation:
- Go SDK - Server-side Go applications
- TypeScript SDK - Node.js and browser JavaScript/TypeScript
- Python SDK - Python applications with asyncio support
- Rust SDK - High-performance Rust applications
- React SDK - React applications with Context, hooks, and components
- Reddit Community - Reddit community for discussions
| Feature | Go | TypeScript | Python | Rust | React |
|---|---|---|---|---|---|
| Authentication | ✅ | ✅ | ✅ | ✅ | ✅ |
| User Management | ✅ | ✅ | ✅ | ✅ | ✅ |
| Resource Management | ✅ | ✅ | ✅ | ✅ | N/A |
| Context Provider | N/A | N/A | N/A | N/A | ✅ |
| Auth Guards | N/A | N/A | N/A | N/A | ✅ |
| Role-based Access | ✅ | ✅ | ✅ | ✅ | ✅ |
| TypeScript Support | N/A | ✅ | N/A | N/A | ✅ |
| Async/Await | N/A | ✅ | ✅ | ✅ | ✅ |
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Make your changes in the appropriate SDK directory
- Add tests for your changes
- Ensure all tests pass (
make testin the SDK directory) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.