Skip to the content.

ADR 0004: OAuth Device Flow, not Personal Access Tokens

Status: Accepted Date: 2026-04-27

Context

To fork repos and clone forks on a user’s behalf, gem-contribute needs an authenticated GitHub session. Two practical options:

  1. Personal Access Token (PAT). User generates a token in GitHub settings, pastes it into the tool.
  2. OAuth Device Authorization Grant (“device flow”). Tool displays a code; user opens browser, signs in, enters code; tool polls for the token. Same UX as gh auth login.

Decision

Device flow.

Reasoning

UX. The PAT flow is genuinely awful: navigate to settings, click through several screens, choose scopes you don’t fully understand, name the token, copy it within the one-time-display window, paste it into the tool, hope you didn’t fat-finger it. Half the people in the workshop room will lose three minutes to this and one will lose ten.

Device flow is approximately: type gem-contribute, click a button in your already-open browser, done. About 30 seconds, no copy-paste, no leaked tokens in shell history.

Critically for an open-source CLI: device flow needs only a client_id, no client secret. We can ship the client ID as a public constant in the source code. There is no secret to protect. This is by design — GitHub’s docs explicitly support this pattern.

Alternatives considered

Consequences