#!/bin/bash
# Test différentes combinaisons de login

KEYCLOAK_URL="http://localhost:8180"
CLIENT_ID="unionflow-server"
CLIENT_SECRET="unionflow-secret-2025"

echo "Test 1: username=superadmin"
curl -s -X POST "$KEYCLOAK_URL/realms/unionflow/protocol/openid-connect/token" \
  -d "client_id=$CLIENT_ID" \
  -d "client_secret=$CLIENT_SECRET" \
  -d "username=superadmin" \
  -d "password=Test@123" \
  -d "grant_type=password" | head -c 200
echo ""

echo "Test 2: username=admin.mukefi"
curl -s -X POST "$KEYCLOAK_URL/realms/unionflow/protocol/openid-connect/token" \
  -d "client_id=$CLIENT_ID" \
  -d "client_secret=$CLIENT_SECRET" \
  -d "username=admin.mukefi" \
  -d "password=Test@123" \
  -d "grant_type=password" | grep -o '"access_token"' | head -1
echo ""
