Skip to main content
A comprehensive Go SDK for integrating Rownd authentication, user management, and group management into your applications.

Installation

Features

  • Token validation and management with EdDSA support
  • User authentication and profile management
  • Group management with member roles and invites
  • HTTP middleware for authentication
  • Comprehensive error handling
  • Configurable caching for JWKs and WKC

Quick start

Quick start with examples

Creating users

Searching for users

Group management examples

Token validation with claims

Helpful utilities

Authentication & token validation

Token validation

HTTP middleware

User management

User operations (CRUD)

Group management

Groups

Group invites

Group membership management

The difference between Group IDs and User IDs

In Rownd’s group system, there are two important identifiers:
  • user_id: The unique identifier for a Rownd user (e.g., “user_a7b53gwdaml5jt7t71442ng7”)
  • member_id: The unique identifier for a user’s membership in a specific group (e.g., “member_dnn5g4e3q5aptail2gr43kpj”)
A single user can be a member of multiple groups, with a different member_id for each group membership.

Managing group members

Important notes about group membership

  1. Member ID vs User ID
    • Use member_id when managing a specific membership (updating roles, removing from group)
    • Use user_id when adding a new member to a group
    • A user (user_id) can have multiple memberships (member_ids) across different groups
  2. Group Ownership
    • Groups must always have at least one owner
    • When removing the last owner, transfer ownership first
    • Example of transferring ownership:
  3. Member States
    • active: Normal membership
    • suspended: Temporarily restricted access
    • invited: Pending acceptance of invitation
  4. Common Role Types
    • owner: Full administrative control
    • admin: Can manage members and content
    • editor: Can modify content
    • viewer: Read-only access
    • Custom roles can be defined as needed

Group ownership and member management rules

Group ownership rules

  1. Automatic owner assignment
    • The first member added to a group automatically receives the “owner” role
    • Example of first member creation:
  2. Owner requirements
    • Every group must maintain at least one owner at all times
    • Attempting to remove the last owner will result in an error
  3. Group deletion requirements
    • A group must have at least one member. To remove all members, delete the group.
    • Correct order of operations:

Error handling

The SDK provides structured error types for better error handling:

Configuration options

Client options

Request options

Testing

Run all tests:
Run specific tests:
Run with timeout:

Types reference

Auth levels

Group admission policies

Environment setup

Using environment variables

Create a .env file in your project root:
Load environment variables in your code:

Environment Files

  1. Add .env to your .gitignore:
  1. For testing, create a separate .env.test:
  1. Load different env files based on environment:

License

This project is licensed under the MIT License - see the LICENSE file for details.