Authentication
Auth flows, API keys, session management, and security specifications for ProBeya integrations.
# 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
| Method | Use case | Token format | Lifetime |
|---|---|---|---|
| API Key | Server-to-server, scripts, CI/CD, MCP | probeya_sk_live_... | Until revoked |
| Session JWT | Browser-based web app | HTTP-only cookie | 8 hours |
| OIDC SSO | Enterprise login (Azure AD, Authentik) | Redirects to IdP | 8-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
Navigate to Settings
Go to Settings > API Keys in your organization.
Create the key
Click Create API Key, enter a name (e.g., “production-etl”), and select scopes.
Copy immediately
The full key is shown once. Copy it and store it in your secrets manager.
Use the key
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:
| Scope | Grants access to |
|---|---|
read:items | List workspaces, projects, boards, items, members |
write:items | Create, update, delete, move items; add comments |
read:kpis | List KPIs, get alerts |
write:kpis | Record KPI measurements |
read:actions | List actions with filters |
write:actions | Create, update, escalate actions |
read:search | Full-text search across items, projects, workspaces |
read:dashboard | Organization-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
| Parameter | Value | Notes |
|---|---|---|
| Max age | 8 hours | Forces re-authentication after this duration |
| Idle timeout | 30 minutes | Client-side SessionMonitor detects inactivity |
| Cookie | authjs.session-token | HTTP-only, Secure, SameSite=Lax |
| Strategy | JWT | No 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.
| Provider | ID | Environment variables |
|---|---|---|
| Authentik (Actigence SSO) | authentik | AUTHENTIK_ISSUER, AUTHENTIK_CLIENT_ID, AUTHENTIK_CLIENT_SECRET |
| Azure AD (Microsoft Entra) | azure-ad | AZURE_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 type | Prefix | Extra controls |
|---|---|---|
| REST API key | probeya_sk_live_ | Scopes only |
| MCP API key | probeya_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 measure | Details |
|---|---|
| Hashing | bcrypt with 10 salt rounds |
| Email verification | Required before first login |
| Login history | All attempts logged with IP address and user agent |
| Audit trail | Session creation and expiry events logged to activity_log |
Rate limiting
| Endpoint | Limit |
|---|---|
POST /api/auth/signin | 10 requests/min per IP |
POST /api/auth/register | 5 requests/min per IP |
POST /api/auth/forgot-password | 3 requests/min per email |
| API key authentication | 1000 requests/min per key |
| MCP tool calls | Tiered 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
Was this page helpful?