-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Summary
I have successfully implemented a comprehensive fix for the authentication persistence issues in linctl. The changes have been committed to the branch fix/authentication-persistence-issues and are ready for review.
Problem Solved
Authentication was getting lost or corrupted after calling linctl a couple of times, causing 401 errors. This was due to dual token storage synchronization issues between ~/.linctl-oauth-token.json and ~/.linctl-auth.json.
Solution Implemented
✅ Unified Token Management: Eliminated dual storage, OAuth tokens now managed exclusively by OAuth TokenStore
✅ Automatic Token Refresh: Added transparent token refresh with retry logic and exponential backoff
✅ Enhanced Error Handling: Better error messages with actionable user guidance
✅ Improved Performance: Reduced token expiry buffer from 5min to 2min
✅ Debug Support: Added LINCTL_DEBUG environment variable for troubleshooting
✅ Backward Compatibility: API key authentication still works as before
Testing Results
✅ Authentication Status: Verified OAuth authentication works correctly
✅ Multiple API Calls: 5 consecutive calls succeeded without errors
✅ Write Operations: Multiple comment creation calls succeeded consistently
✅ Test Suite: All OAuth and auth tests passing
Branch Information
- Branch:
fix/authentication-persistence-issues - Commit:
ce3dd1d - Files Changed: 6 files, +251 insertions, -1196 deletions
Next Steps
Please create a pull request from the fix/authentication-persistence-issues branch to master for review and merging.
The fix is transparent to users and eliminates the "authentication lost after a few calls" issue while maintaining full backward compatibility.