feat: Add OAuth authentication with dynamic client registration - #6
Merged
Conversation
Implements secure OAuth 2.0 authentication flow with PKCE for twist-cli: - OAuth 2.0 with PKCE (S256) for secure authentication without client secrets - Dynamic Client Registration (DCR) creates fresh client credentials per session - Local callback server (port 8766) with automatic browser opening - Proper resource cleanup to prevent server leaks (inspired by todoist-cli PR #5) - HTTP Basic auth for token exchange following RFC 6749 - Comprehensive error handling and user-friendly messages - Full test coverage including edge cases and cleanup scenarios Security improvements: - No hardcoded client secrets in source code - Fresh client credentials per authentication session - State parameter validation for CSRF protection - Secure code challenge/verifier generation and validation New commands: - `tw auth login` - OAuth browser authentication (new) - `tw auth token <token>` - Manual token entry (existing, unchanged) - `tw auth status` - Show authentication status (updated help text) - `tw auth logout` - Clear saved token (existing, unchanged) Backward compatibility maintained for existing token-based authentication. Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
github-actions Bot
pushed a commit
that referenced
this pull request
Jan 22, 2026
# 1.0.0 (2026-01-22) ### Bug Fixes * add UTF-8 charset to OAuth callback HTML responses ([#8](#8)) ([fcb2d49](fcb2d49)) ### Features * Add Biome linting, upgrade to Node 20, and add CI workflows ([#3](#3)) ([57f802e](57f802e)) * add loading animations with global API proxy integration ([#7](#7)) ([bf53bfb](bf53bfb)) * Add OAuth authentication with dynamic client registration ([#6](#6)) ([2845ebd](2845ebd)), closes [#5](#5) * add semantic release automation for NPM publishing ([#10](#10)) ([c756324](c756324)) * Refactor login command to auth with status/logout subcommands ([#4](#4)) ([59e6493](59e6493))
|
🎉 This PR is included in version 1.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements secure OAuth 2.0 authentication for twist-cli using Dynamic Client Registration (DCR) and PKCE flow:
twd_*client credentials per sessionNew Authentication Flow
Security Features
Why DCR?
Dynamic Client Registration eliminates the security risk of hardcoded client secrets while providing the same user experience as other OAuth flows. Each authentication session gets fresh, temporary credentials that are discarded after use.
🤖 Generated with Claude Code