sso.analytics reads organization login analytics. Every method requires the
authenticated user to hold the live audit_logs:view capability in the target
organization. Suspended organizations and cross-tenant access are rejected.
Methods
| Method | API route | Result |
|---|---|---|
getLoginTrends(orgSlug, query?) |
GET /api/organizations/{org_slug}/analytics/login-trends |
LoginTrendPoint[] |
getLoginsByService(orgSlug, query?) |
GET /api/organizations/{org_slug}/analytics/logins-by-service |
LoginsByService[] |
getLoginsByProvider(orgSlug, query?) |
GET /api/organizations/{org_slug}/analytics/logins-by-provider |
LoginsByProvider[] |
getRecentLogins(orgSlug, query?) |
GET /api/organizations/{org_slug}/analytics/recent-logins |
RecentLogin[] |
start_date and end_date use YYYY-MM-DD. Invalid or omitted dates fall back
to the trailing 30-day window. limit applies to recent logins and is clamped
to 1–100; the default is 10.
const recent = await sso.analytics.getRecentLogins('acme', { limit: 20 });
Result types
interface LoginTrendPoint {
date: string | null;
count: number;
}
interface LoginsByService {
service_id: string;
service_name: string;
count: number;
}
interface LoginsByProvider {
provider: string;
count: number;
}
interface RecentLogin {
id: string;
user_id: string;
service_id: string | null;
provider: string;
created_at: string;
}
Provider names are not a closed enum because AuthOS can record configured upstream providers as well as built-in authentication providers.