feat(examples): add bash-cli example using device code flow#3
feat(examples): add bash-cli example using device code flow#3
Conversation
- Implement OAuth 2.0 Device Authorization Grant (RFC 8628) in pure bash - Support OIDC auto-discovery, token caching, and refresh token rotation - Handle cross-platform date conversion for macOS and Linux - Add bash-cli section to examples README
- Pass POST data and auth headers via stdin to prevent token leaks in process list - URL-encode all form data values for correctness - Use mktemp for unpredictable temp file paths - Fix cache file permissions on load - Consolidate multi-jq calls into single invocations per function - Use bash parameter expansion in _parse_response hot path - Extract run_device_flow to eliminate duplicated prompt block - Remove redundant fetch_userinfo call from print_token_info - Detect platform date flavor once at startup
There was a problem hiding this comment.
Pull request overview
Adds a new bash-based CLI example demonstrating AuthGate authentication via OAuth 2.0 Device Authorization Grant (RFC 8628), complementing the existing Go/Python examples and enabling a “no SDK” flow using only common CLI tools.
Changes:
- Introduces
bash-cli/main.sh, a pure Bash implementation of the device code flow with OIDC discovery, token caching, refresh, and re-auth on invalid tokens. - Updates the root
README.mdto document how to run the new Bash CLI example.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 10 comments.
| File | Description |
|---|---|
| bash-cli/main.sh | New Bash device-code CLI with discovery, polling, refresh, cache read/write, and token/userinfo/tokeninfo output |
| README.md | Adds a brief section documenting the new Bash CLI example |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…nt field shifting
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 13 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…detection, non-fatal cache ops
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…re-auth on 401/403
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
curlandjq— no SDK or runtime neededTest plan
jqinstalled → dependency errorgo-clioutput🤖 Generated with Claude Code