← All work

03 Qik Office Backend

A public API and OAuth server for a multi-tenant SaaS

Qik Office's public API and the OAuth 2.0 server behind it, designed so that every token is granted by a person, to a named app, for permissions they can actually read and understand.

Role
AI Product Engineer
When
2026
Live
api.qik.mt/docs ↗
  • FastAPI
  • REST
  • OAuth 2.0
  • PKCE (S256)
  • OpenAPI 3.1
  • MySQL
  • E2E & fuzz testing
Screenshot of api.qik.mt/docs
  • 56endpoints in the first release
  • 37granular OAuth scopes
  • 27end-to-end test suites
  • 150+operations the API has grown to since
How it works
  1. 01Your appserver or browser
  2. 02Consentnamed scopes
  3. 03Code + PKCES256 only
  4. 04Tokensrotating refresh
  5. 05/v1 APIacts as the person

The problem

Qik Office holds a company’s rooms, messages, meetings, transcripts, schedules and tasks. Customers wanted their other software, such as calendar tools, task trackers and their own scripts, to read and write that data.

The hard part isn’t serving JSON. It’s permission. Every request has to act as a specific person, see exactly what they can see, and only do what they agreed to. And they have to be able to take that back at any time.

What I built

I built the public /v1 REST API and the OAuth 2.0 authorization server behind it, as a new layer over the existing application. The work covered:

  • the first set of resource endpoints (rooms, workspaces, messages, meetings, schedules, sprints and todos)
  • a serializer that gives every response the same shape ({ "data": … } or { "error": { "code", "message" } })
  • an OpenAPI 3.1 generator and an interactive docs page where you can sign in and call the real API

The API launched with 56 endpoints. The team has since grown it past 150 operations on the same foundation.

Security decisions

  • PKCE for every app, including server apps. Only S256 is accepted; plain is refused and has no code path. An authorization code that leaks from a log or a Referer header is useless without the verifier.
  • No secrets where they can’t stay secret. Server apps get a client secret. Browser and mobile apps don’t, because anything shipped to a user can be read out of it.
  • Refresh tokens rotate in families. Each use returns a new token and retires the old one. If a retired token shows up again, that’s treated as theft and the whole family is revoked. A family ID is created before the first insert, so revoking a family is a single update. Refreshes are also rate-limited per family.
  • Closing a routing hole. The framework’s router treated every inherited public method as a route. That would have exposed about 14 base-controller methods as unauthenticated /oauth/* endpoints. The OAuth controller deliberately doesn’t inherit from the base controller.

Scopes that mean something

There are 37 scopes, and each one is something a person can understand on a consent screen:

  • Narrower where it matters. transcripts.read is separate from meetings.read, because listing your meetings is different from reading a verbatim record of a private conversation. Likewise, adding people to a room (room_members.write) is a different power from renaming it.
  • No empty permissions. There is no meetings.write, because there is no write operation on a meeting. A scope that grants nothing is just noise on a consent screen.
  • Write doesn’t imply read, and the broad qik.read / qik.write scopes match exactly, never as prefixes. sprints.* isn’t a wildcard; it’s an unknown scope.
  • Incremental consent. Apps can ask for more access later with include_granted_scopes, and the person sees only what’s new.

Proving it

The API shipped with 27 end-to-end suites covering the OAuth flows and every /v1 resource. Fuzz coverage is driven by a route map, and the run fails if any operation isn’t covered, so a new endpoint can’t quietly ship untested. I also ran mutation trials by hand to check that the tests catch real bugs, not just that they pass.