- Go to: ultracard.io/wp-admin/plugins.php
- Deactivate: "Ultra Card Integration"
- Upload:
/Users/wayne/Ultra Card/ultra-card-integration.php - Activate: "Ultra Card Integration"
The plugin will automatically create the wp_ultra_card_sessions table.
phpMyAdmin or Database Tool:
SHOW TABLES LIKE 'wp_ultra_card_sessions';Should see: 1 table found ✅
View structure:
DESCRIBE wp_ultra_card_sessions;Should see: 9 columns (id, session_id, user_id, user_data, device_id, device_name, created_at, last_validated, expires_at)
Option A - HACS (Recommended):
- HACS will auto-update on next refresh
- Or manually: HACS → Custom repositories → Ultra Card → Redownload
Option B - Manual:
- Copy
/Users/wayne/Ultra Card/ultra-card.js - Upload to:
/config/www/ultra-card/ultra-card.js - Add cache-busting parameter in dashboard:
?v=2.0-beta8
Desktop:
// Browser console (F12)
localStorage.clear();
location.reload();Mobile:
- HA App → Settings → Clear Frontend Cache
- Or restart HA app
Test:
- Login on desktop → Check console for session creation
- Open mobile → Should auto-login (check console)
- Logout on mobile → Desktop logs out within 30s
After deployment, verify each item:
- Plugin activated successfully
- Database table
wp_ultra_card_sessionsexists - Table has 9 columns with correct structure
- REST API endpoint responds:
https://ultracard.io/wp-json/ultra-card/v1/session/create - Cron job registered:
wp_next_scheduled('ultra_card_cleanup_sessions')
-
ultra-card.jsuploaded to Home Assistant - Cache cleared on all devices
- Console shows: "✅ Cloud session sync enabled"
- Version shows: "🚀 Ultra Card v2.0-beta8"
- Login on desktop creates session in database
- Console shows: "✅ Cloud session created: sess_..."
- Mobile device auto-authenticates without login
- Console shows: "✅ Found active cloud session"
- PRO modules unlocked on mobile
- Logout on one device logs out both devices
- Session validation polling runs every 30 seconds
Desktop Console:
// After logging in, check:
fetch('https://ultracard.io/wp-json/ultra-card/v1/session/create', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_JWT_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
device_id: 'test123',
device_name: 'Test Device',
}),
})
.then(r => r.json())
.then(d => console.log('Session Create:', d));
// Expected: {success: true, session_id: "sess_...", expires_at: ...}fetch('https://ultracard.io/wp-json/ultra-card/v1/session/current', {
method: 'GET',
headers: {
Authorization: 'Bearer YOUR_JWT_TOKEN',
},
})
.then(r => r.json())
.then(d => console.log('Current Session:', d));
// Expected: {success: true, session: {session_id: "...", user: {...}}}fetch('https://ultracard.io/wp-json/ultra-card/v1/session/validate', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_JWT_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
session_id: 'sess_YOUR_SESSION_ID',
}),
})
.then(r => r.json())
.then(d => console.log('Validate:', d));
// Expected: {success: true, valid: true, user: {...}}fetch('https://ultracard.io/wp-json/ultra-card/v1/session/logout', {
method: 'DELETE',
headers: {
Authorization: 'Bearer YOUR_JWT_TOKEN',
},
})
.then(r => r.json())
.then(d => console.log('Logout:', d));
// Expected: {success: true, message: "Session invalidated"}Problem: Old build deployed
Fix: Force refresh with Ctrl+F5 (Cmd+Shift+R on Mac)
Problem: Database table missing or REST API blocked
Fix:
-- Manually create table
CREATE TABLE wp_ultra_card_sessions (
id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
session_id varchar(64) NOT NULL,
user_id bigint(20) UNSIGNED NOT NULL,
user_data longtext NOT NULL,
device_id varchar(255),
device_name varchar(255),
created_at datetime NOT NULL,
last_validated datetime NOT NULL,
expires_at datetime NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY session_id (session_id),
KEY user_id (user_id),
KEY expires_at (expires_at)
);Problem: Session expired or not created
Fix:
-- Check if session exists
SELECT * FROM wp_ultra_card_sessions WHERE user_id = YOUR_USER_ID;
-- If exists but expired, shows expires_at < NOW()
-- If not exists, user needs to login on first deviceProblem: Cache not cleared or session not synced
Fix:
- Force refresh: Ctrl+F5
- Clear localStorage:
localStorage.clear() - Check console for cloud session messages
- Verify JWT token is valid
- Clear cache: Settings → Companion App → Reset Frontend Cache
- May need to restart app completely
- Check Console: Safari → Develop → Your iPhone → Home Assistant
- Clear cache: Settings → Companion App → Clear Frontend Cache
- May need to force close and restart
- Check Console: Chrome → chrome://inspect → Your Device
If you need to disable cloud sync:
Edit src/services/uc-cloud-auth-service.ts:
constructor() {
this._loadFromStorage();
this._setupAutoRefresh();
// DISABLED - Uncomment to re-enable
// ucSessionSyncService.enable();
this._checkCloudSession();
}Rebuild: npm run build
- Restore previous
ultra-card-integration.php - Restore previous
ultra-card.js - Optionally drop table:
DROP TABLE wp_ultra_card_sessions;
Auth will work in localStorage-only mode (single device).
If issues persist:
-
Check WordPress Debug Log:
tail -f wp-content/debug.log | grep "Ultra Card"
-
Check Browser Console: F12 → Console tab
-
Check Database:
SELECT COUNT(*) FROM wp_ultra_card_sessions;
-
Test Endpoints: Use Postman or curl with your JWT token
Before:
- Login on desktop ❌ Still locked on mobile
- Login on mobile ❌ Still locked on desktop
- Have to login on each device separately
After:
- Login on desktop ✅ Mobile unlocks automatically!
- Login on mobile ✅ Desktop unlocks automatically!
- Logout anywhere ✅ All devices logout together!
True cross-device authentication sync is now live! 🚀