Custom auth strategies
For auth beyond PATs, implement AuthStrategy:
import type { AuthStrategy } from "@renai-labs/sdk"
interface AuthStrategy { apply(req: { headers: Headers; url: URL }): void | Promise<void>}
const apiKey: AuthStrategy = { apply: ({ headers }) => { headers.set("X-Api-Key", process.env.MY_KEY!) },}
createRenClient({ baseUrl, auth: apiKey })Token rotation
const rotating: AuthStrategy = { apply: async ({ headers }) => { const token = await fetchFreshToken() headers.set("Authorization", `Bearer ${token}`) },}Related
- Authentication — PAT setup.
- Client — client configuration.