Files
media-downloader/scripts/get-api-token.sh
Todd 0d7b2b1aab Initial commit
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-29 22:42:55 -04:00

19 lines
665 B
Bash
Executable File

#!/bin/bash
# Get API token for claude_test account and save to /tmp/api_token.txt
# Usage: /opt/media-downloader/scripts/get-api-token.sh
#
# After running this, use api-call.sh to make authenticated requests:
# /opt/media-downloader/scripts/api-call.sh "/api/video-queue?limit=2"
TOKEN=$(curl -s -X POST "http://localhost:8000/api/auth/login" \
-H "Content-Type: application/json" \
-d '{"username": "claude_test", "password": "ClaudeTest2025Secure"}' | jq -r '.token')
if [ "$TOKEN" != "null" ] && [ -n "$TOKEN" ]; then
echo "$TOKEN" > /tmp/api_token.txt
echo "Token saved to /tmp/api_token.txt"
else
echo "Failed to get token"
exit 1
fi