Quickstart
Install the @katforge/api, authenticate, make a call.
Install
shell
npm install @katforge/api
Authenticate
TypeScript
import { KATforge, browserStorage } from '@katforge/api';
const katforge = new KATforge ({
baseUrl: 'https://api.katforge.com',
storage: browserStorage
});
// Guest (no signup)
const session = await katforge.auth.guest ();
// Or email/password
const session = await katforge.auth.login ('anders@example.com', 'hunter2');
Make a call
TypeScript
// Current user
const me = await katforge.users.me ();
// Lextris leaderboard
for await (const entry of katforge.games.lextris.leaderboard ({ mode: 'daily' })) {
console.log (entry.display_name, entry.score);
}
// Stumper categories
const cats = await katforge.games.stumper.categories ();
Without the @katforge/api
shell
# Get a guest token
curl -X POST https://api.katforge.com/v1/gateway/guest \
-H 'Content-Type: application/json' \
-d '{}'
# Use it
curl https://api.katforge.com/v1/users/@me \
-H "Authorization: Bearer $ACCESS_TOKEN"
What's next
- Identity — the shared player model
- Authentication — JWT lifecycle, refresh, OAuth
- Packages — the full @katforge/api surface
- API Reference — every endpoint