-
Notifications
You must be signed in to change notification settings - Fork 0
Authentication
StreamTV supports authentication with Archive.org to access restricted content that requires a login.
To enable Archive.org authentication, edit your config.yaml:
archive_org:
enabled: true
preferred_format: "h264"
username: "your_username" # Your Archive.org username
password: "your_password" # Your Archive.org password
use_authentication: true # Enable authentication-
Never commit credentials: Make sure
config.yamlis in.gitignore(it already is) - Use environment variables: For production, consider using environment variables instead of storing passwords in config files
-
File permissions: Ensure
config.yamlhas restricted permissions (e.g.,chmod 600 config.yaml)
- Initial Login: When authentication is enabled, StreamTV will automatically log in to Archive.org on first use
- Session Management: The adapter maintains session cookies for authenticated requests
- Automatic Re-authentication: If a session expires, StreamTV will automatically attempt to re-authenticate
- Transparent Usage: Once configured, authentication works transparently - all Archive.org requests will use authenticated sessions
You can test if authentication is working by:
- Adding a restricted Archive.org item:
curl -X POST http://localhost:8410/api/media \
-H "Content-Type: application/json" \
-d '{
"source": "archive_org",
"url": "https://archive.org/details/RESTRICTED_ITEM_IDENTIFIER"
}'- If authentication is working, you should be able to access the item. If not, you'll get a permission error.
Symptoms: Logs show "Archive.org login failed" or "Invalid credentials"
Solutions:
- Verify your username and password are correct
- Check that
use_authenticationis set totrue - Ensure Archive.org account is active and not locked
- Check network connectivity to Archive.org
Symptoms: Initially works, then starts getting 403 errors
Solutions:
- StreamTV should automatically re-authenticate, but if issues persist:
- Restart the StreamTV server
- Verify credentials are still valid
- Check Archive.org service status
Symptoms: Getting 403 or PermissionError even with authentication
Solutions:
- Verify the item actually requires authentication (some items may be completely restricted)
- Check that your Archive.org account has access to the item
- Some items may require special permissions or membership
Instead of storing credentials in config.yaml, you can use environment variables:
export ARCHIVE_ORG_USERNAME="your_username"
export ARCHIVE_ORG_PASSWORD="your_password"Then update your config to read from environment:
# In config.py (would need modification)
username: os.getenv("ARCHIVE_ORG_USERNAME")
password: os.getenv("ARCHIVE_ORG_PASSWORD")To disable authentication:
archive_org:
use_authentication: falseOr simply remove/comment out the username and password fields.
Authentication events are logged at INFO level:
- Successful authentication: "Successfully authenticated with Archive.org"
- Failed authentication: "Archive.org login failed: Invalid credentials"
- Session expiration: "Archive.org session expired, re-authenticating..."
Check your logs (default: streamtv.log or console output) for authentication status.