A Python library for securely retrieving GitHub tokens from system keychains across different operating systems.
- Cross-platform support:
- macOS: Uses Keychain Access
- Windows: Uses Credential Manager
- Linux: Uses libsecret
- Secure token retrieval
- Token validation
- Comprehensive error handling
- Logging support
- Python 3.6 or higher
- Git (with credentials configured)
# Ubuntu/Debian
sudo apt-get install libsecret-tools
# Fedora
sudo dnf install libsecret
pip install githubauthlib
# Clone the repository
git clone https://github.com/GIALaboratory/cloud-platform-engineering.git
# Navigate to the library directory
cd cloud-platform-engineering/githubauthlib
# Install the package
pip install .
from githubauthlib import get_github_token, GitHubAuthError
try:
token = get_github_token()
if token:
print("Token retrieved successfully!")
else:
print("No token found in system keychain")
except GitHubAuthError as e:
print(f"Error retrieving token: {e}")
# Check installed version
pip list | grep githubauthlib
# View package details
pip show githubauthlib
For development, you may want to add the package directory to your PYTHONPATH. See AUXILIARY.md for detailed instructions.
-
Token Not Found
- Verify Git credentials are properly configured
- Check system keychain for GitHub credentials
-
Permission Issues
- Ensure proper system keychain access
- Verify Python has required permissions
-
Linux Issues
- Confirm libsecret-tools is installed
- Check D-Bus session is running
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.