18
scripts/get-api-token.sh
Executable file
18
scripts/get-api-token.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user