API Library
API library reference for the guestbook application.
Your Supabase Tokens
For calls that do not require a JWT, set Authentication apikey to your NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY. Test Request sends it on every call.
To test the authenticated calls with this page, you'll need retrieve your admin JSON Web Token (JWT), which is kind of hacky to snag. Note that you'll need to retrieve a new JWT every time you close and reopen your browser to test the authenticated calls as it's tied to your admin login session.
For example, in Chrome:
-
Login to your guestbook admin dashboard.
-
Open Developer Tools in your browser (
F12orright-click> Inspect). -
Click Console.
-
If you've never pasted into your terminal before, you might need to enable pasting first.
In the terminal, type allow pasting and press Enter.
-
Paste the following command and press Enter:
(() => { const chunks = document.cookie.split("; ") .map((row) => { const i = row.indexOf("="); return [row.slice(0, i), decodeURIComponent(row.slice(i + 1))]; }) .filter(([name]) => name.includes("-auth-token") && !name.includes("code-verifier")) .sort(([a], [b]) => a.localeCompare(b, undefined, { numeric: true })); const joined = chunks.map(([, value]) => value).join(""); const encoded = joined.startsWith("base64-") ? joined.slice(7) : joined; const session = JSON.parse(atob(encoded.replace(/-/g, "+").replace(/_/g, "/"))); copy(session.access_token); return session.access_token; })(); -
Right click and select Copy string contents to copy the output to your clipboard.
-
When you're in the Test Request form, or after you set your Supabase Project ID in the section below:
- Open Authentication, select
apikey, and enter yourNEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY. - Select
bearerAuth, and enter yourBearer Token: <your-admin-auth-token>.
- Open Authentication, select
-
Click Send.