4Climbers Wordpress-Express Integration
Wordpress plugin to login via firebase in a woocommerce/wordpress app
by Alessandro Defendenti (Rollercoders) · github.com/rollercoders/4climbers-wordpress-express-integration
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/rollercoders/4climbers-wordpress-express-integration/archive/refs/heads/develop.zipFirebase-WooCommerce Integration
✨ Plugin per sincronizzazione utenti tra WooCommerce e Firebase.
🔁 Flusso
Caso A – Registrazione via app (Firebase)
-
L'utente si registra nell'app (tramite Firebase Auth)
-
Il backend Express chiama:
POST /wp-json/firebase/v1/create-user -
WordPress crea l'utente WooCommerce corrispondente, con ruolo
customer
Caso B – Registrazione via WooCommerce
- L’utente si registra tramite
/my-accounto in fase di checkout - WooCommerce intercetta la password da
$_POST - Alla creazione dell’utente (
user_register), WordPress chiama il backend Express per creare l’utente su Firebase
Caso C – Eliminazione utente da Firebase
-
Se l’utente viene eliminato in Firebase (es. da pannello admin), il backend Express chiama:
DELETE /wp-json/firebase/v1/delete-user/:email -
WordPress cerca l’utente tramite email ed esegue
wp_delete_user()
🔐 Sicurezza
-
Tutte le chiamate server-to-server sono protette via header:
X-WP-Secret: <shared secret> -
Nel file
wp-config.php, aggiungi:define('FIREBASE_SYNC_SECRET', 'la-tua-chiave-super-segreta'); define('FIREBASE_SYNC_ENDPOINT', 'https://tuo-backend.it/api/firebase-sync');
⚙️ Setup
-
Installa il plugin all’interno di WordPress (come plugin ZIP oppure via FTP)
-
Aggiungi le costanti nel
wp-config.phpcome indicato sopra -
Il tuo backend Express deve:
- Esporre
/api/firebase-sync(protetto daX-WP-Secret) - Chiamare
/wp-json/firebase/v1/create-userogni volta che registra un nuovo utente Firebase - Chiamare
/wp-json/firebase/v1/delete-user/:emailquando elimina un utente
- Esporre
🧪 Debug
- Il plugin logga tutto solo se
WP_DEBUG === true - Tutti i
error_log()sono condizionati, quindi in produzione non scrive nulla
✅ Stato attuale
- [x] Registrazione Woo → Firebase
- [x] Registrazione Firebase → Woo
- [x] Cancellazione Firebase → Woo (
DELETE /delete-user/:email) - [x] Sicurezza server-to-server
- [x] Logging controllato da
WP_DEBUG - [x] Pulizia automatica dei dati sensibili (password via
transientTTL)