43 lines
1.3 KiB
PowerShell
43 lines
1.3 KiB
PowerShell
# Simple verification script for user field fix
|
|
|
|
$baseUrl = "http://localhost:5000"
|
|
$loginUrl = "$baseUrl/api/auth/login"
|
|
|
|
$loginPayload = @{
|
|
email = "admin@test.com"
|
|
password = "Test@123456"
|
|
tenantSlug = "testcompany"
|
|
} | ConvertTo-Json
|
|
|
|
Write-Host "Testing Login Flow..." -ForegroundColor Cyan
|
|
|
|
try {
|
|
$response = Invoke-RestMethod -Uri $loginUrl -Method Post -Body $loginPayload -ContentType "application/json"
|
|
|
|
Write-Host "Login successful!" -ForegroundColor Green
|
|
Write-Host ""
|
|
Write-Host "User Object from Backend:" -ForegroundColor Cyan
|
|
$response.user | Format-List
|
|
|
|
$token = $response.accessToken
|
|
$headers = @{ Authorization = "Bearer $token" }
|
|
|
|
Write-Host ""
|
|
Write-Host "Testing /me Endpoint..." -ForegroundColor Cyan
|
|
$meResponse = Invoke-RestMethod -Uri "$baseUrl/api/auth/me" -Method Get -Headers $headers
|
|
|
|
Write-Host "/me endpoint successful!" -ForegroundColor Green
|
|
Write-Host ""
|
|
Write-Host "User Object from /me:" -ForegroundColor Cyan
|
|
$meResponse | Format-List
|
|
|
|
Write-Host ""
|
|
Write-Host "Verification Complete!" -ForegroundColor Green
|
|
|
|
} catch {
|
|
Write-Host "Error: $($_.Exception.Message)" -ForegroundColor Red
|
|
if ($_.ErrorDetails) {
|
|
Write-Host "Details: $($_.ErrorDetails.Message)" -ForegroundColor Red
|
|
}
|
|
}
|