Files
unionflow-server-impl-quarkus/test-auth-simple.sh
2025-09-19 16:09:21 +00:00

34 lines
1.1 KiB
Bash

#!/bin/bash
echo "Test authentification avec compte existant..."
response=$(curl -s -X POST \
"http://192.168.1.145:8180/realms/unionflow/protocol/openid-connect/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=test@unionflow.dev&password=test123&grant_type=password&client_id=unionflow-mobile")
if echo "$response" | grep -q "access_token"; then
echo "✓ Authentification réussie avec test@unionflow.dev"
# Extraire le token
access_token=$(echo "$response" | grep -o '"access_token":"[^"]*' | cut -d'"' -f4)
# Obtenir les infos utilisateur
user_info=$(curl -s -X GET \
"http://192.168.1.145:8180/realms/unionflow/protocol/openid-connect/userinfo" \
-H "Authorization: Bearer ${access_token}")
echo "Infos utilisateur: $user_info"
echo ""
echo "🎉 KEYCLOAK FONCTIONNE PARFAITEMENT !"
echo ""
echo "Vous pouvez maintenant tester l'application mobile avec :"
echo "Username: test@unionflow.dev"
echo "Password: test123"
else
echo "✗ Échec authentification"
echo "Réponse: $response"
fi