Aniworld/test_auth.ps1

14 lines
578 B
PowerShell

$loginResponse = Invoke-WebRequest -Uri "http://127.0.0.1:8000/auth/login" -Method POST -ContentType "application/json" -Body '{"password": "admin123"}'
$loginData = $loginResponse.Content | ConvertFrom-Json
$token = $loginData.token
Write-Host "Token: $token"
# Test the anime search with authentication
$headers = @{
"Authorization" = "Bearer $token"
"Content-Type" = "application/json"
}
$searchResponse = Invoke-WebRequest -Uri "http://127.0.0.1:8000/api/anime/search?query=naruto" -Headers $headers
Write-Host "Search Response:"
Write-Host $searchResponse.Content