How to put the console inside your app
The console your app serves at {api_prefix}/_telltale/admin/ asks for a key. You can show it on an admin page of your own app instead, where your admins are already signed in.
-
Let your admins into the telltale API with an
authorizehook:def authorize(request):user = current_user(request)return "admin" if user and user.is_admin else Nonett.authorize = authorizeWith this hook set, the API is mounted even when no key is set.
-
Add the console to an admin page, with your app’s authenticated fetch:
import { TelltaleConsole } from './vendor/telltale/react/TelltaleConsole.jsx'import './vendor/telltale/console/console.css'<TelltaleConsole apiBase="/api/_telltale" fetch={authedFetch} app="myapp" />Without React, call
mountConsole(element, { apiBase, fetch, app })fromconsole/console.js. -
Match your app’s look. The console takes all its styles from
--tt-*CSS variables on.tt-console:.tt-console {--tt-font-family: var(--app-font);--tt-accent: var(--app-primary);}The console README lists every variable.
-
Check it. Signed in as an admin, the page shows the console with no key prompt. Signed in as anyone else, the API answers 401.