Skip to content

Models

package models

AuthKit does not persist anything itself. Every grant flow and endpoint depends on one or more manager interfaces defined in the models package. Implement them against whatever storage you already use — Postgres, MySQL, Redis, in-memory for a prototype — and pass them to a flow's Config via the corresponding Set*Manager method.

Manager interfaces by flow

ManagerUsed byPurpose
ClientManagerAll grants, introspectionLook up registered OAuth clients, their redirect URIs, and authentication method.
AuthCodeManagerAuthorization CodePersist an issued authorization code and redeem it exactly once.
TokenManagerAll grants, introspectionIssue, persist, and look up access and refresh tokens.
UserManagerROPCVerify submitted username/password credentials.

Reference implementation

A reference SQL implementation of these interfaces is included in integrations/sql — useful as a starting point to read or fork rather than a required dependency. AuthKit itself has no opinion on your schema or database engine; the SQL package is one example, not the contract.

Where to start

If you're implementing these for the first time, start with ClientManager and TokenManager — every grant needs both. Add AuthCodeManager if you're using Authorization Code, or UserManager if you're using ROPC.

For the exact method signatures, see models/README.md and integrations/sql/ in the repository.

Released under the BSD-3-Clause License.