Skip to content

auth login fails with 429 rate limit error when exchanging device code for OAuth token #309

@jamesdlevine

Description

@jamesdlevine

Description

When running pdd auth login in a remote SSH session, the authentication flow fails with a 429 Too Many Requests error from GitHub's OAuth endpoint.

Steps to Reproduce

  1. Connect to a remote machine via SSH
  2. Run pdd auth login
  3. Open https://github.com/login/device in a browser and enter the provided code
  4. Wait for authentication to complete

Expected Behavior

The device code should be successfully exchanged for an OAuth access token after the user authorizes the application in their browser.

Actual Behavior

The authentication fails with:

Token error: Error exchanging device code for token: 429 Client Error: Too Many Requests for url:
https://github.com/login/oauth/access_token

Error during 'unknown' command:
An unexpected error occurred: Process exited with code 1

Environment

  • pdd-cli version: 0.0.115 → 0.0.116 (upgraded during session)
  • Python: 3.12 (miniconda)
  • Platform: Linux (remote SSH session)
  • Note: Keyring backend unavailable (warning shown)

Additional Context

  • The session was detected as a remote SSH session (SSH_CONNECTION environment variable detected)
  • A keyring warning was also shown: "No recommended backend was available"
  • The 429 error suggests the device code polling may be occurring too frequently, exceeding GitHub's rate limits for the OAuth device flow

Possible Causes

  1. The polling interval for the device code flow may be too aggressive (GitHub recommends at least 5 seconds between polls)
  2. Multiple concurrent authentication attempts may have exhausted the rate limit
  3. The retry logic may not be respecting the interval or slow_down responses from GitHub

Suggested Fix

Review the device code polling implementation to ensure it:

  • Respects the interval parameter returned by GitHub (default 5 seconds)
  • Handles slow_down error responses by increasing the polling interval
  • Implements exponential backoff on 429 errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions