ganshik

Cross-domain authentication server — acc.grimdork.net

Authentication

Public (no API key required)

MethodPathAuthDescription
POST /auth/verify none Verify username + password + domain credentials. Does not create a token. Body: {"username","password","domain"}. Response: {"valid":bool,"error":"..."}
POST /auth/admin/auth none Authenticate as an admin user. User must have an admin API key. Creates a 24h admin session token. Body: {"username","password"}. Response: {"valid":bool,"token":"...","expires_at":"..."}

Admin-key-gated (Authorization: Bearer <admin-key>)

MethodPathAuthDescription
POST /auth/admin/check admin Verify an admin session token. Body: {"username","token"}. Response: {"valid":bool,"error":"..."}
POST /auth/admin/revoke admin Revoke an admin session token. Body: {"username","token"}. Response: {"revoked":true}

Domain-key-gated (Authorization: Bearer <domain-key>)

Admin keys are also accepted as wildcards on these endpoints (except /auth/domain/login).

MethodPathAuthDescription
POST /auth/domain/login domain Authenticate a user for the key's domain. Creates a 24h session token. Body: {"username","password"}. Response: {"valid":bool,"token":"...","expires_at":"...","profile":{...}}
POST /auth/domain/check domain / admin Verify a domain session token. Admin key skips domain match. Body: {"username","token"}. Response: {"valid":bool,"error":"..."}
POST /auth/domain/revoke domain / admin Revoke a domain session token. Admin key skips domain match. Body: {"username","token"}. Response: {"revoked":true}

User Management

MethodPathAuthDescription
GET/api/usersadmin / domainList all users
POST/api/usersadmin / domainCreate user. Domain-scoped key also creates a profile. Body: {"username","password","full_name","address"}
GET/api/users/:idadminGet user details
PUT/api/users/:idadminUpdate user. Body: {"full_name","address"}
DELETE/api/users/:idadminDelete user and all associated data
POST/api/users/:id/passwordadminSet or test password. Body: {"password","test_only":bool}

Domain Management

MethodPathAuthDescription
GET/api/domainsadminList all domains
POST/api/domainsadminCreate domain. Body: {"name"}
GET/api/domains/:idadminGet domain details
PUT/api/domains/:idadminUpdate domain. Body: {"name"}
DELETE/api/domains/:idadminDelete domain and all associated profiles/keys
GET/api/domains/:id/keysadminList API keys for a domain
POST/api/domains/:id/keysadminCreate domain API key. Body: {"user_id":int}

Profile Management

MethodPathAuthDescription
GET/api/profilesadmin / domainList profiles. Domain-scoped sees only their domain. Query: ?domain=N
POST/api/profilesadminCreate profile. Body: {"user_id":int,"domain_id":int,"status":"..."}
PUT/api/profiles/:idadminUpdate profile status. Body: {"status"}
DELETE/api/profiles/:idadmin / domainDelete profile. Domain-scoped: only own domain.

API Key Management

MethodPathAuthDescription
GET/api/admin/keysadminList all admin API keys
POST/api/admin/keysadminCreate admin API key. Body: {"user_id":int}
DELETE/api/admin/keys/:idadminDelete an admin API key

Session Token Management

MethodPathAuthDescription
DELETE/api/tokens/:idadminRevoke any session token by database ID

User Data

MethodPathAuthDescription
GET/api/userdataadmin / domainGet user data. Query: ?user_id=N&domain_id=N
PUT/api/userdataadmin / domainUpsert user data. Body: {"user_id":int,"domain_id":int,"data":{...}}