Briggs Rajagopalan
03/23/2026, 6:19 PMDevRev
03/23/2026, 6:19 PMBriggs Rajagopalan
03/23/2026, 6:20 PMDevRev
03/23/2026, 6:21 PMBriggs Rajagopalan
03/23/2026, 6:21 PMDevRev
03/23/2026, 6:21 PM// iOS example - parse JWT payload
let payload = try JWT.decode(token, verify: false)
let userRoles = payload["roles"] as? [String] ?? []
Security Considerations
• Client-side authorization is for UX only - never trust it for security
• Always validate permissions server-side for sensitive operations
• JWT expiration should still be checked client-side
• Consider refresh token flow for longer sessions
Hybrid Approach
Use client-side claims for immediate UI decisions (show/hide features) while validating critical actions server-side when connectivity returns. This gives users a responsive experience while maintaining security.
The mobile SDKs store tokens securely and provide methods to access claims without network calls.Briggs Rajagopalan
03/23/2026, 6:40 PMDevRev
03/23/2026, 6:41 PM// Example tenant attributes
{
"plan_tier": "premium",
"enabled_features": ["analytics", "api_access", "custom_branding"]
}
Include in JWT Claims
Configure JWT templates to include tenant attributes as custom claims :
// JWT payload example
{
"sub": "user123",
"tenant": {
"id": "tenant_abc",
"plan_tier": "premium",
"enabled_features": ["analytics", "api_access"]
}
}
Mobile Implementation
Parse JWT claims client-side to control feature visibility:
// iOS example
let planTier = jwt["tenant"]["plan_tier"] as? String
let enabledFeatures = jwt["tenant"]["enabled_features"] as? [String] ?? []
if enabledFeatures.contains("analytics") {
// Show analytics features
}
This approach provides tenant-aware authorization where the same user can have different capabilities across tenants .
Tenants | Descope Documentation
JWT Templates | Descope Documentation
Descope vs Auth0 for B2B Auth and SSO
Top 7 RBAC Providers for B2B SaaS Apps