# Authenticate with an API key — works immediately
curl https://acme.probeya.com/api/v1/workspaces \
  -H "Authorization: Bearer probeya_sk_live_a1b2c3d4..."

ProBeya supports three authentication methods depending on your integration type.

Choose your auth method

MethodUse caseToken formatLifetime
API KeyServer-to-server, scripts, CI/CD, MCPprobeya_sk_live_...Until revoked
Session JWTBrowser-based web appHTTP-only cookie8 hours
OIDC SSOEnterprise login (Azure AD, Authentik)Redirects to IdP8-hour session

API keys

API keys are the recommended way to authenticate programmatic access. Each key is scoped to a single organization and inherits the permissions of the user who created it.

Generate a key

1

Navigate to Settings

Go to Settings > API Keys in your organization.

2

Create the key

Click Create API Key, enter a name (e.g., “production-etl”), and select scopes.

3

Copy immediately

The full key is shown once. Copy it and store it in your secrets manager.

Use the key

curl https://acme.probeya.com/api/v1/actions?boardId=clx_board_1 \
  -H "Authorization: Bearer probeya_sk_live_a1b2c3d4e5f6..."

Key format and security

probeya_sk_live_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6
|_____________| |______| |____________________________________________|
    prefix      lookup              bcrypt-hashed secret
                prefix
               (8 chars)            (40 hex chars = 160 bits entropy)
  • Only the bcrypt hash is stored in the database — the full key cannot be recovered
  • The 8-character lookup prefix enables efficient database queries without scanning all keys
  • bcrypt.compare() is timing-safe, preventing timing attacks
  • Revoked or expired keys are rejected after hash verification (no information leakage about key existence)

Scopes

API keys can be restricted to specific scopes:

ScopeGrants access to
read:itemsList workspaces, projects, boards, items, members
write:itemsCreate, update, delete, move items; add comments
read:kpisList KPIs, get alerts
write:kpisRecord KPI measurements
read:actionsList actions with filters
write:actionsCreate, update, escalate actions
read:searchFull-text search across items, projects, workspaces
read:dashboardOrganization-level statistics

An API key with no scopes selected has full access to all endpoints. Use scoped keys for least-privilege integrations.

Error responses

// 401 — Missing or invalid key
{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid API key"
  }
}

// 403 — Key is valid but lacks required scope
{
  "error": {
    "code": "FORBIDDEN",
    "message": "API key does not have scope: write:actions"
  }
}

// 403 — Key is revoked
{
  "error": {
    "code": "FORBIDDEN",
    "message": "API key has been revoked"
  }
}

Session authentication (browser)

The ProBeya web app uses Auth.js v5 with JWT-based sessions stored in HTTP-only cookies.

Flow

1. User submits email + password (or clicks SSO button)
        |
2. Auth.js validates credentials (bcrypt.compare for passwords, OIDC for SSO)
        |
3. JWT issued with userId + defaultOrganizationId
        |
4. Token stored in HTTP-only cookie (authjs.session-token)
        |
5. Middleware reads JWT on every request
        |
6. tRPC context receives authenticated user
        |
7. orgProcedure wraps query in RLS-scoped transaction

Session parameters

ParameterValueNotes
Max age8 hoursForces re-authentication after this duration
Idle timeout30 minutesClient-side SessionMonitor detects inactivity
Cookieauthjs.session-tokenHTTP-only, Secure, SameSite=Lax
StrategyJWTNo server-side session store needed

SSO providers

ProBeya supports enterprise SSO via OpenID Connect. Providers are conditionally loaded based on environment variables — missing vars do not crash the server.

ProviderIDEnvironment variables
Authentik (Actigence SSO)authentikAUTHENTIK_ISSUER, AUTHENTIK_CLIENT_ID, AUTHENTIK_CLIENT_SECRET
Azure AD (Microsoft Entra)azure-adAZURE_AD_CLIENT_ID, AZURE_AD_CLIENT_SECRET, AZURE_AD_TENANT_ID

Redirect URI pattern: {APP_URL}/api/auth/callback/{provider-id}

MCP authentication

MCP connections use the same API key system with an additional MCP-specific key type for granular AI controls:

Key typePrefixExtra controls
REST API keyprobeya_sk_live_Scopes only
MCP API keyprobeya_mcp_live_Scopes + allowed tools + allowed resources + monthly token budget

See the MCP guide for details.

Password security

Passwords are hashed with bcrypt (10 salt rounds). Login attempts (both successful and failed) are recorded in the login_history table for compliance auditing.

Security measureDetails
Hashingbcrypt with 10 salt rounds
Email verificationRequired before first login
Login historyAll attempts logged with IP address and user agent
Audit trailSession creation and expiry events logged to activity_log

Rate limiting

EndpointLimit
POST /api/auth/signin10 requests/min per IP
POST /api/auth/register5 requests/min per IP
POST /api/auth/forgot-password3 requests/min per email
API key authentication1000 requests/min per key
MCP tool callsTiered by organization plan

After 5 consecutive failed login attempts, the account is temporarily locked for 15 minutes. This is logged in the audit trail.

Next steps