OAuth Device Flow Library (src/index.ts)

kimi-code · packages/oauth/src/index.ts · typescript · MIT
auth, database, lang:typescript, tag:device-flow, tag:tokens

Exports OAuth device authorization, token refresh, storage backends, error types, and manager utilities. Reuse for CLI or app authentication flows needing device-code login and token persistence.

// Source: https://github.com/MoonshotAI/kimi-code | License: MIT | Copyright 2026 Moonshot AI
// Provided via justclaw.it.com; keep this notice with the code.
export {
  DeviceCodeExpiredError,
  DeviceCodeTimeoutError,
  OAuthAccessDeniedError,
  OAuthConnectionError,
  OAuthError,
  OAuthUnauthorizedError,
  RetryableRefreshError,
} from './errors';

export type {
  DeviceAuthorization,
  DeviceHeaders,
  OAuthFlowConfig,
  OAuthStorageBackend,
  TokenInfo,
  TokenInfoWire,
} from './types';
export { tokenFromWire, tokenToWire } from './types';

export type { TokenStorage } from './storage';
export { FileTokenStorage } from './storage';

export type { DevicePollResult, RefreshOptions } from './oauth';
export { pollDeviceToken, refreshAccessToken, requestDeviceAuthorization } from './oau

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key