Unified User Profile Implementation for Mini-Programs in Super App
Super App — container application where independent mini-programs run: marketplace, taxi, delivery, finance, government services. Key principle: user logs in once, all mini-programs get profile without re-authentication. Architecture of this mechanism determines platform's security and UX.
Unified Profile Architecture
Super App stores master user profile: ID, name, avatar, verified email and phone, payment methods, addresses, KYC status. Mini-programs get only what they requested — principle of least privilege.
Data transmission mechanism: on mini-program launch, Super App passes short-lived token (not master JWT) with limited scope. Mini-program uses this token to call its backend, which validates it via Super App Auth Service.
Super App ──launch(miniProgramToken)──► Mini Program
Mini Program ──validateToken──► Super App Auth API
Super App Auth API ──{userId, allowedScopes}──► Mini Program Backend
Profile Transmission Implementation
On Flutter, mini-programs can be implemented as Flutter modules loaded dynamically. Super App passes profile via Platform Channel:
// Super App — sending profile to mini-program
class MiniProgramHost {
static const _channel = MethodChannel('super_app/mini_program_bridge');
Future<void> launchMiniProgram(String miniProgramId) async {
final token = await authService.generateMiniProgramToken(
miniProgramId: miniProgramId,
scopes: ['profile.basic', 'phone.verified'],
expiresIn: Duration(minutes: 30),
);
await _channel.invokeMethod('launch', {
'miniProgramId': miniProgramId,
'token': token,
'theme': ThemeManager.current.toJson(),
});
}
}
For React Native mini-programs similarly via Native Module. For WebView-based mini-programs (like WeChat mini-programs) — via postMessage with origin check.
Scope and User Consent
User must know what data each mini-program gets. On first mini-program launch, Super App shows consent screen: "App X requests access to your name, phone number, and order history. Allow?"
Consent stored in Super App profile, not requested again. User can revoke permission in profile settings — then mini-program on next open gets token without scope rights, and its backend must handle limited access.
Session Management
If user logs out of Super App (or session expires) — all mini-programs must know immediately. Mechanism: Super App broadcast via Platform Channel to all active mini-programs session_expired event. Each mini-program must handle it and block further actions until re-authorization.
Unified profile + secure token transmission mechanism + consent screens + session event handling — 3–5 weeks. Cost estimated individually depending on mini-program count and platform.







