This scenario demonstrates how a packaged app can let end users sign in with GitHub using OAuth Device Flow, then use that user token to call Copilot with their own subscription.
- Starts GitHub OAuth Device Flow
- Prompts the user to open the verification URL and enter the code
- Polls for the access token
- Fetches the signed-in user profile
- Calls Copilot with that OAuth token (SDK clients in TypeScript/Python/Go)
- A GitHub OAuth App client ID (
GITHUB_OAUTH_CLIENT_ID) copilotbinary (COPILOT_CLI_PATH, or auto-detected by SDK)- Node.js 20+
- Python 3.10+
- Go 1.24+
cd typescript
npm install --ignore-scripts
npm run build
GITHUB_OAUTH_CLIENT_ID=Ivxxxxxxxxxxxx node dist/index.jscd python
pip3 install -r requirements.txt --quiet
GITHUB_OAUTH_CLIENT_ID=Ivxxxxxxxxxxxx python3 main.pycd go
go run main.go./verify.shverify.sh checks install/build for all languages. Interactive runs are skipped by default and can be enabled by setting both GITHUB_OAUTH_CLIENT_ID and AUTH_SAMPLE_RUN_INTERACTIVE=1.
To include this sample in the full suite, run ./verify.sh from the samples/ root.