requestDeviceCode (providers/codebuddyDeviceAuth.ts)

OmniRoute · src/lib/oauth/providers/codebuddyDeviceAuth.ts · typescript · MIT
auth

Implements CodeBuddy OAuth device flow, requesting device codes and polling tokens.

// Source: https://github.com/diegosouzapw/OmniRoute | License: MIT | Copyright 2026 diegosouzapw
// Provided via justclaw.it.com; keep this notice with the code.
export interface CodeBuddyDeviceCodeConfig {
  stateUrl: string;
  tokenUrl: string;
  userAgent: string;
  platform: string;
  domain?: string;
  pollInterval?: number;
}

export interface CodeBuddyDeviceCodeResponse {
  device_code: string;
  user_code: string;
  verification_uri: string;
  verification_uri_complete: string;
  expires_in: number;
  interval: number;
}

export interface CodeBuddyTokens {
  access_token: string;
  refresh_token: string;
  token_type: string;
  expires_in?: number;
}

interface CodeBuddyEnvelope<T> {
  code?: number;
  data?: T;
  msg?: string;
}

interface CodeBuddyStatePayload {
  state?: string

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

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

Get a free API key