{"id":34717977,"url":"https://github.com/vaintrub/logto-go","last_synced_at":"2026-04-02T23:34:28.900Z","repository":{"id":327138538,"uuid":"1106721577","full_name":"vaintrub/logto-go","owner":"vaintrub","description":"Go client for Logto Management API","archived":false,"fork":false,"pushed_at":"2025-12-26T10:51:40.000Z","size":277,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-26T12:42:13.336Z","etag":null,"topics":["authentication","authorization","identity","identity-provider","idp","logto"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vaintrub.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-29T20:07:47.000Z","updated_at":"2025-12-26T10:49:36.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/vaintrub/logto-go","commit_stats":null,"previous_names":["vaintrub/logto-go"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/vaintrub/logto-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaintrub%2Flogto-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaintrub%2Flogto-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaintrub%2Flogto-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaintrub%2Flogto-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vaintrub","download_url":"https://codeload.github.com/vaintrub/logto-go/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaintrub%2Flogto-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28384017,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T10:34:27.190Z","status":"ssl_error","status_checked_at":"2026-01-13T10:34:26.289Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","authorization","identity","identity-provider","idp","logto"],"created_at":"2025-12-25T01:18:25.687Z","updated_at":"2026-01-16T17:42:26.022Z","avatar_url":"https://github.com/vaintrub.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# logto-go\n\nGo client for [Logto](https://logto.io) Management API.\n\n\u003e **Note**: This is a Management API client for server-side operations.\n\u003e For user authentication, use the [official Logto Go SDK](https://github.com/logto-io/go).\n\n## Installation\n\n```bash\ngo get github.com/vaintrub/logto-go\n```\n\n## Quick Start\n\n```go\nimport (\n    \"context\"\n\n    logto \"github.com/vaintrub/logto-go\"\n)\n\nc, err := logto.NewClient(\n    \"https://your-tenant.logto.app\",\n    \"m2m-app-id\",\n    \"m2m-app-secret\",\n    logto.WithResource(\"https://your-tenant.logto.app/api\"),\n)\n\nctx := context.Background()\n\n// Get user\nuser, err := c.GetUser(ctx, \"user-id\")\n\n// Create user\nnewUser, err := c.CreateUser(ctx, logto.UserCreate{\n    Username: \"john\",\n    Password: \"SecurePass123!\",\n})\n\n// List organizations\norgs, err := c.ListOrganizations(ctx)\n```\n\n## Features\n\n- M2M Authentication with automatic token caching\n- Users, Organizations, Roles, Scopes CRUD\n- Organization invitations\n- JWT validation with JWKS\n- Pagination iterators\n- HTTP connection pooling with optimized defaults\n\n## Configuration Options\n\n| Option | Description | Default |\n|--------|-------------|---------|\n| `logto.WithTimeout(d)` | HTTP client timeout | 5s |\n| `logto.WithHTTPClient(c)` | Custom HTTP client (overrides timeout) | - |\n| `logto.WithResource(url)` | M2M resource URL | - |\n| `logto.WithScope(s)` | M2M scope | \"all\" |\n\n## Error Handling\n\n```go\nimport logto \"github.com/vaintrub/logto-go\"\n\nif errors.Is(err, logto.ErrNotFound) {\n    // handle 404\n}\nif errors.Is(err, logto.ErrRateLimited) {\n    // handle 429\n}\nif errors.Is(err, logto.ErrUserNotFound) {\n    // user not found in search results\n    // also matches ErrNotFound\n}\n```\n\n## Pagination with Iterators\n\n```go\niter := c.ListUsersIter(100) // page size\nfor iter.Next(ctx) {\n    user := iter.User()\n    fmt.Println(user.ID, user.Username)\n}\nif err := iter.Err(); err != nil {\n    // handle error\n}\n\n// Or collect all at once\nusers, err := c.ListUsersIter(100).Collect(ctx)\n```\n\n## JWT Validation\n\n```go\nimport (\n    \"time\"\n\n    \"github.com/vaintrub/logto-go/validator\"\n)\n\nv, err := validator.NewJWKSValidator(\n    \"https://your-tenant.logto.app/oidc/jwks\",\n    \"https://your-tenant.logto.app/oidc\",\n    \"https://api.example.com\", // audience\n    time.Hour,                 // JWKS cache TTL\n    nil,                       // optional logger\n)\n\ntokenInfo, err := v.ValidateToken(ctx, bearerToken)\nuserID := tokenInfo.GetUserID()\norgID := tokenInfo.GetOrganizationID()\n\nif tokenInfo.HasScope(\"read:users\") {\n    // allowed\n}\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaintrub%2Flogto-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvaintrub%2Flogto-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaintrub%2Flogto-go/lists"}