Skip to content

Tighten CodeResponse types for OAuth error vs success cases #907

@frano-m

Description

@frano-m

Follow-up to #906 / #905 (per Copilot review).

CodeResponse in src/google/types.ts currently models all fields as required string. In practice, Google's OAuth code flow returns different shapes for success vs error:

  • Success: code is set; error* fields are absent
  • Error: error is set; code is absent
  • scope and state may also be absent depending on configuration

Suggest making the fields optional or using a discriminated success/error union to better reflect reality. Currently cosmetic — we don't read the error fields at runtime, but loose typing risks incorrect downstream assumptions.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions