Refactoring
This commit is contained in:
33
test-auth-simple.sh
Normal file
33
test-auth-simple.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user