degreelink

Admin API Tokens and Plan Access Sessions

This document explains how admin API tokens are used, how plan-code sessions work, and how the frontend cooperates with both flows.

Overview

The backend exposes operations under /api. There are two orthogonal access models:

These models can be used together: an admin can also operate within plan sessions, but admin token is not required for plan-scoped edits.


Admin Token Authentication

File: backend/auth.py

Example protected endpoints (subject to change):

Frontend usage (file: frontend/src/services/api.js):

How to supply a token during development:


Plan-code Sessions

File: backend/routes/plans.py

Access checks:

Rate limiting:

What plan-code sessions can do:

What plan-code sessions cannot do:

Session utilities:


Frontend Behavior

Progress refresh:

Modals and focus:


Security Considerations & Recommendations


Quick Reference

Environment variables (backend):

Headers (frontend → backend):

Plan session lifecycle:

  1. Client verifies/opens a plan by code
  2. Server sets session cookies with accessed_plan_id and timestamp
  3. Client can read/update plan-scoped resources without admin token until session expires
  4. Session can be cleared via /api/plans/session/clear