Determines if an OAuth token needs refresh and performs refresh with retry logic.
// Source: https://github.com/ndycode/codex-multi-auth | License: MIT | Copyright 2026 ndycode
// Provided via justclaw.it.com; keep this notice with the code.
/**
* Token refresh helpers for the custom fetch implementation
* Extracted from fetch-helpers.ts (audit roadmap §4.1.2); fetch-helpers.ts
* re-exports the public symbols so existing importers are unchanged.
*/
import type { Auth, CodexClient } from "@codex-ai/sdk";
import { queuedRefresh } from "../refresh-queue.js";
import type { TokenResult } from "../types.js";
import { CodexAuthError } from "../errors.js";
import { HTTP_STATUS, ERROR_MESSAGES } from "../constants.js";
interface CodexAuthSetter {
auth: {
set(args: {
path: { id: string };
body: {
type: "oauth";
access: string;
refresh: string;
expir
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key