$account = $env:UMS_ADMIN_ACCOUNT $password = $env:UMS_ADMIN_PASSWORD if ([string]::IsNullOrWhiteSpace($account) -or [string]::IsNullOrWhiteSpace($password)) { throw "UMS_ADMIN_ACCOUNT and UMS_ADMIN_PASSWORD must be set before running this script." } $headers = @{ "Content-Type" = "application/json" } $body = (@{ account = $account; password = $password } | ConvertTo-Json -Compress) Write-Host "=== Verification ===" -ForegroundColor Cyan $resp = Invoke-RestMethod -Uri 'http://localhost:8080/api/v1/auth/login' -Method POST -Headers $headers -Body $body Write-Host "`n[1] Login Response:" -ForegroundColor Yellow Write-Host " User ID: $($resp.data.user.id)" Write-Host " Username: $($resp.data.user.username)" Write-Host " Nickname: $($resp.data.user.nickname)" -ForegroundColor Green Write-Host " Email: $($resp.data.user.email)" $token = $resp.data.access_token $csrf = Invoke-RestMethod -Uri 'http://localhost:8080/api/v1/auth/csrf-token' -Method GET -Headers $headers Write-Host "`n[2] CSRF Token:" -ForegroundColor Yellow Write-Host " Token: $($csrf.data.csrf_token)" $me = Invoke-RestMethod -Uri 'http://localhost:8080/api/v1/auth/userinfo' -Method GET -Headers @{ Authorization = "Bearer $token" } Write-Host "`n[3] Current User Info:" -ForegroundColor Yellow Write-Host " ID: $($me.data.id)" Write-Host " Nickname: $($me.data.nickname)" -ForegroundColor Green $logs = Invoke-RestMethod -Uri 'http://localhost:8080/api/v1/logs/login?page=1&page_size=3' -Method GET -Headers @{ Authorization = "Bearer $token" } Write-Host "`n[4] Login Logs:" -ForegroundColor Yellow Write-Host " Total: $($logs.data.total)" foreach ($log in $logs.data.items) { Write-Host " - UserID: $($log.user_id), Status: $($log.status), Time: $($log.created_at)" -ForegroundColor Gray } $perms = Invoke-RestMethod -Uri 'http://localhost:8080/api/v1/permissions?page=1&page_size=5' -Method GET -Headers @{ Authorization = "Bearer $token" } Write-Host "`n[5] Permissions:" -ForegroundColor Yellow foreach ($perm in $perms.data.items) { Write-Host " - $($perm.name) ($($perm.code))" -ForegroundColor Gray } Write-Host "`nVerification complete." -ForegroundColor Green