Bridge Validation β
Bridge Validation is the core mechanism that connects your Flowfull backend to Flowless (the authentication server on Pubflow).
What is Bridge Validation? β
Think of it as a trust bridge between your custom backend and the authentication system. Instead of building authentication from scratch, you validate sessions through this bridge.
Why Use Bridge Validation? β
Traditional approach:
- β Build user registration
- β Build login system
- β Build session management
- β Build password reset
- β Build email verification
- β Maintain security updates
Bridge Validation approach:
- β Use Flowless on Pubflow for all auth
- β Validate sessions via Bridge Validation
- β Focus on your business logic
How It Works β
βββββββββββββββ ββββββββββββββββ βββββββββββββββ
β Client ββββββββββΆβ Flowfull ββββββββββΆβ Flowless β
β (Frontend) β 1οΈβ£ β (Your Backend)β 2οΈβ£ β (Pubflow) β
βββββββββββββββ ββββββββββββββββ βββββββββββββββ
β 3οΈβ£
βΌ
ββββββββββββ
β Cache β
β (LRU/Redis)β
ββββββββββββFlow: β
- Client sends request with
X-Session-Idheader - Flowfull checks cache (LRU or Redis) for session
- If not cached, validates with Flowless API
- Caches result for future requests
- Returns user data to your route handler
Implementation β
Node.js/TypeScript β
typescript
import { BridgeValidator } from './lib/bridge';
const validator = new BridgeValidator({
flowlessUrl: process.env.FLOWLESS_URL,
bridgeSecret: process.env.BRIDGE_SECRET,
validationMode: 'STANDARD'
});
// Validate session
const session = await validator.validateSession(
sessionId,
ipAddress,
userAgent,
deviceId
);
if (session) {
console.log('User:', session.user_id);
console.log('Email:', session.email);
}Go β
go
package main
import (
"github.com/pubflow/flowfull-go/bridge"
)
func main() {
validator := bridge.NewValidator(bridge.Config{
FlowlessURL: os.Getenv("FLOWLESS_URL"),
BridgeSecret: os.Getenv("BRIDGE_SECRET"),
ValidationMode: "STANDARD",
})
session, err := validator.ValidateSession(
sessionID,
ipAddress,
userAgent,
deviceID,
)
if err == nil {
fmt.Println("User:", session.UserID)
}
}Python β
python
from flowfull import BridgeValidator
validator = BridgeValidator(
flowless_url=os.getenv("FLOWLESS_URL"),
bridge_secret=os.getenv("BRIDGE_SECRET"),
validation_mode="STANDARD"
)
session = await validator.validate_session(
session_id=session_id,
ip_address=ip_address,
user_agent=user_agent,
device_id=device_id
)
if session:
print(f"User: {session.user_id}")Configuration β
Environment Variables β
env
# Flowless Configuration
FLOWLESS_URL=https://your-instance.pubflow.com
BRIDGE_SECRET=your-bridge-secret-here
# Validation Mode
VALIDATION_MODE=STANDARD # DISABLED, STANDARD, ADVANCED, STRICT
# Cache Configuration
CACHE_ENABLED=true
CACHE_TTL=3600 # 1 hourValidation Modes β
- DISABLED - No validation (development only)
- STANDARD - IP address validation
- ADVANCED - IP + User-Agent validation
- STRICT - IP + User-Agent + Device ID validation
Learn more about Validation Modes β
Performance β
Bridge Validation uses caching for optimal performance:
- Cache Hit: 1-2ms response time
- Cache Miss: 20-50ms (validates with Flowless)
- Hit Rate: 95-99% in production
Cache Strategy β
- Check LRU cache (in-memory, fastest)
- Check Redis cache (shared across instances)
- Validate with Flowless (source of truth)
- Update caches for future requests
Security β
Bridge Validation includes multiple security layers:
- Secret Validation - Bridge secret must match
- Session Expiration - Expired sessions rejected
- IP Validation - IP address must match (STANDARD+)
- User-Agent Validation - Browser must match (ADVANCED+)
- Device ID Validation - Device must match (STRICT)
Best Practices β
β Do β
- Use
STANDARDmode for most applications - Enable caching for performance
- Set appropriate cache TTL (1-24 hours)
- Use
STRICTmode for sensitive operations - Monitor cache hit rates
β Don't β
- Use
DISABLEDmode in production - Skip caching (performance impact)
- Set cache TTL too high (stale data)
- Hardcode bridge secret in code
- Ignore validation errors
Troubleshooting β
Session Not Found β
Problem: Session not found error
Solutions:
- Check session ID is correct
- Verify session hasn't expired
- Ensure Flowless URL is correct
- Check bridge secret matches
Invalid Bridge Secret β
Problem: Invalid bridge secret error
Solutions:
- Verify
BRIDGE_SECRETin.env - Check secret matches Flowless instance
- Ensure no extra spaces in secret
Cache Issues β
Problem: Stale session data
Solutions:
- Reduce cache TTL
- Clear cache after user logout
- Use Redis for shared cache
Next Steps β
- Validation Modes - Configure security levels
- HybridCache - Optimize performance
- Auth Middleware - Protect routes
Need Help? β
- π Notside.com - Professional Pubflow implementation services
- π§ Email: contact@notside.com
- πΌ Services: Custom development, consulting, enterprise support