Skip to content

Comments

Add GitHub API client with OAuth token support#52

Draft
Copilot wants to merge 3 commits intomasterfrom
copilot/add-access-token-response
Draft

Add GitHub API client with OAuth token support#52
Copilot wants to merge 3 commits intomasterfrom
copilot/add-access-token-response

Conversation

Copy link

Copilot AI commented Feb 16, 2026

Implements GitHub API integration supporting OAuth access tokens and Personal Access Tokens with Bearer authentication, following the existing CDP API pattern.

Implementation

Core Client (fetch-github-api.js)

  • OAuth token support (gho_*) and PAT support (ghp_*, ghs_*, ghu_*, ghr_*)
  • Bearer token authentication with standard GitHub API headers
  • HTTP methods: GET, POST, PUT, PATCH, DELETE
  • Rate limit tracking via response headers
  • Environment variable and CLI argument configuration

Tooling

  • Shell wrapper (fetch-github-api.sh)
  • Demo script with 5 usage examples (demo-github-api.sh)
  • Test suite with token validation and format verification (test-github-api.js)

Documentation

  • Complete API reference (GITHUB_API_README.md)
  • OAuth token format specification (OAUTH_TOKEN_EXAMPLE.md)
  • Example JSON response (oauth-token-response-example.json)
  • Updated main README and devtools README

OAuth Token Format

Handles the standard GitHub OAuth response:

{
  "access_token": "gho_16C7e42F292c6912E7710c838347Ae178B4a",
  "token_type": "bearer",
  "scope": "repo,gist"
}

Usage

export GITHUB_TOKEN="gho_16C7e42F292c6912E7710c838347Ae178B4a"
export REQUEST_PATH="/user"
node contrib/devtools/fetch-github-api.js

Or via CLI arguments:

node contrib/devtools/fetch-github-api.js \
  --token "gho_xxxxx" \
  --method GET \
  --path "/repos/bitcoin/bitcoin"

Files Added

  • contrib/devtools/fetch-github-api.js (256 lines)
  • contrib/devtools/fetch-github-api.sh (51 lines)
  • contrib/devtools/demo-github-api.sh (98 lines)
  • contrib/devtools/test-github-api.js (203 lines)
  • contrib/devtools/GITHUB_API_README.md (271 lines)
  • contrib/devtools/OAUTH_TOKEN_EXAMPLE.md (95 lines)
  • contrib/devtools/oauth-token-response-example.json

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh gh pr view --json title,body (http block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 16, 2026 06:28
- Add fetch-github-api.js with OAuth token support
- Add shell wrapper and demo script
- Add comprehensive test suite
- Update documentation in README.md
- Add GITHUB_API_README.md with detailed usage

Co-authored-by: Kushmanmb <193178375+Kushmanmb@users.noreply.github.com>
- Add OAUTH_TOKEN_EXAMPLE.md with detailed explanation
- Add oauth-token-response-example.json with response format
- Document token types, scopes, and security practices

Co-authored-by: Kushmanmb <193178375+Kushmanmb@users.noreply.github.com>
Copilot AI changed the title [WIP] Add access token response handling Add GitHub API client with OAuth token support Feb 16, 2026
Copy link
Member

@Kushmanmb Yaketh (Kushmanmb) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kushmanmb.eth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants