# Script pour mettre à jour Keycloak avec URL HTTP temporaire $KeycloakUrl = "http://192.168.1.11:8180" $Realm = "unionflow" $ClientId = "unionflow-mobile" Write-Host "=== MISE À JOUR AVEC URL HTTP TEMPORAIRE ===" -ForegroundColor Cyan try { # Obtenir token admin $tokenResponse = Invoke-RestMethod -Uri "$KeycloakUrl/realms/master/protocol/openid-connect/token" -Method Post -ContentType "application/x-www-form-urlencoded" -Body "username=admin&password=admin&grant_type=password&client_id=admin-cli" $accessToken = $tokenResponse.access_token # Récupérer le client $headers = @{ "Authorization" = "Bearer $accessToken" } $clients = Invoke-RestMethod -Uri "$KeycloakUrl/admin/realms/$Realm/clients?clientId=$ClientId" -Method Get -Headers $headers $client = $clients[0] $clientUuid = $client.id Write-Host "Client trouvé: $clientUuid" -ForegroundColor Green # Mettre à jour avec URL HTTP temporaire $client.redirectUris = @( "http://192.168.1.11:8080/auth/callback", "http://192.168.1.11:8080/auth/callback/*", "com.unionflow.mobile://callback", "com.unionflow.mobile://login-callback" ) $client.webOrigins = @( "http://192.168.1.11:8080", "+" ) # Convertir en JSON et mettre à jour $clientJson = $client | ConvertTo-Json -Depth 10 Invoke-RestMethod -Uri "$KeycloakUrl/admin/realms/$Realm/clients/$clientUuid" -Method Put -Headers $headers -Body $clientJson -ContentType "application/json" Write-Host "✅ Configuration mise à jour avec URL HTTP:" -ForegroundColor Green Write-Host " - http://192.168.1.11:8080/auth/callback" -ForegroundColor Gray Write-Host " - http://192.168.1.11:8080/auth/callback/*" -ForegroundColor Gray Write-Host " - com.unionflow.mobile://callback (backup)" -ForegroundColor Gray Write-Host " - com.unionflow.mobile://login-callback (backup)" -ForegroundColor Gray } catch { Write-Host "Erreur: $($_.Exception.Message)" -ForegroundColor Red }