TrademarkTrademark
Ctrl k
Search docs...
Sdk

Backend Integration

Last update: September 1, 2025
Thumbnail of Backend Integration
Go is supported by default. The sdk is available as a Go module.
PyPI versionPython versions
Crates.ioDocumentationLicense
npm versionnpm downloads
Choose your language and install the appropriate SDK:
go get github.com/melvinodsa/go-iam-sdk/golang
package main

import (
  "context"
  "log"
  goiam "github.com/melvinodsa/go-iam-sdk/golang"
)

func main() {
  service := goiam.NewService(
      "https://your-go-iam-server.com",
      "your-client-id",
      "your-client-secret"
  )

  // Ready to use!
}
ctx := context.Background()
token, err := service.Verify(ctx, "auth-code") 
if err != nil {
  log.Fatalf("Failed to verify: %v", err)
}
fmt.Println("Access Token:", token)}
Once authenticated, retrieve current user details:
user, err := service.Me(ctx, token)
if err != nil {
  log.Fatalf("Failed to fetch user: %v", err)
}
fmt.Printf("User: %+v", user)
Create and manage resources in your application:
resource := &golang.Resource{
  ID:          "resource-id",
  Name:        "User Dashboard",
  Description: "Main user dashboard resource",
  Tags:        []string{"dashboard", "user"},
}

err = service.CreateResource(ctx, resource, "token")
if err != nil {
  log.Fatalf("Failed to create resource: %v", err)
}

err = service.DeleteResource(ctx, resource.ID, "token")
if err != nil {
  log.Fatalf("Failed to delete resource: %v", err)
}
type User struct {
    Id             string                  `json:"id"`
    ProjectId      string                  `json:"project_id"`
    Name           string                  `json:"name"`
    Email          string                  `json:"email"`
    Phone          string                  `json:"phone"`
    Enabled        bool                    `json:"enabled"`
    ProfilePic     string                  `json:"profile_pic"`
    LinkedClientId string                  `json:"linked_client_id,omitempty"`
    Expiry         *time.Time              `json:"expiry"`
    Roles          map[string]UserRole     `json:"roles"`
    Resources      map[string]UserResource `json:"resources"`
    Policies       map[string]UserPolicy   `json:"policies"`
    CreatedAt      *time.Time              `json:"created_at"`
    CreatedBy      string                  `json:"created_by"`
    UpdatedAt      *time.Time              `json:"updated_at"`
    UpdatedBy      string                  `json:"updated_by"`
}

type UserPolicy struct {
    Name    string            `json:"name"`
    Mapping UserPolicyMapping `json:"mapping,omitempty"`
}

type UserPolicyMapping struct {
    Arguments map[string]UserPolicyMappingValue `json:"arguments,omitempty"`
}

type UserPolicyMappingValue struct {
    Static string `json:"static,omitempty"`
}

type UserRole struct {
    Id   string `json:"id"`
    Name string `json:"name"`
}

type UserResource struct {
    RoleIds   map[string]bool `json:"role_ids"`
    PolicyIds map[string]bool `json:"policy_ids"`
    Key       string          `json:"key"`
    Name      string          `json:"name"`
}
type Resource struct {
      ID          string     `json:"id"`
      Name        string     `json:"name"`
      Description string     `json:"description"`
      Key         string     `json:"key"`
      Enabled     bool       `json:"enabled"`
      ProjectId   string     `json:"project_id"`
      CreatedAt   *time.Time `json:"created_at"`
      CreatedBy   string     `json:"created_by"`
      UpdatedAt   *time.Time `json:"updated_at"`
      UpdatedBy   string     `json:"updated_by"`
      DeletedAt   *time.Time `json:"deleted_at,omitempty"`
}
On this page
Docs
Blog
Community
GitHub
© 2025 Go IAM. Open source under Apache 2.0 License.