November 23, 2026
OAuth Is Not the Finish Line: Testing Token Lifecycle and Mobile API Trust Boundaries
An advanced methodology for identifying authorization failures, token misuse, refresh-token weaknesses, and mobile-to-backend trustβ¦

By Rebline CyberSec | Security Research
3 min read
API & MOBILE SECURITY
An advanced methodology for identifying authorization failures, token misuse, refresh-token weaknesses, and mobile-to-backend trust problems.
A. Article information
Field β Details
Category β API & Mobile Security
Audience β API VAPT, mobile pentesters, AppSec
Difficulty β Advanced
Reading time β 14β18 minutes
Core technologies β OAuth 2.0, JWT, Android, REST
Key references β RFC 9700 and RFC 10017
Why now: RFC 10017, published in August 2026, provides current best-practice guidance for OAuth 2.0 in browser-based applications. RFC 9700 remains an important security baseline. Together, they create an opportunity to investigate the complete authentication and token lifecycle rather than focusing on JWT signature verification alone.
B. Detailed article blueprint
1. Introduction
A mobile application may use secure HTTPS connections, encrypted token storage, and JWT signatures while still implementing weak authorization.
The important research question:
Does the backend correctly enforce identity, token purpose, session state, and resource permissions throughout the entire application lifecycle?
2. Technical background
Cover:
- OAuth authorization code flow.
- PKCE.
- Access tokens versus refresh tokens.
- JWT header, payload, and signature.
- Token issuer and audience validation.
- Expiration and revocation.
- Refresh-token rotation.
- Device binding.
- Certificate validation.
- Deep links and redirect URI security.
Explain that a JWT is a token format, not an authorization policy.
3. Threat model
Android / iOS application
OAuth authorization server
Authorization code Β· PKCE Β· Token issuance
API resource server
Signature Β· Issuer Β· Audience Β· Scope Β· Authorization
Protected business resources
Testing must cover every trust boundary, not just the mobile application.
4. Advanced testing methodology
- Extract application endpoints from an authorized lab APK.
- Identify authorization and token endpoints.
- Map the OAuth flow.
- Inspect redirect URI validation.
- Verify PKCE implementation.
- Inspect token claims without exposing live secrets.
- Test access-token expiration.
- Test refresh-token rotation and reuse detection.
- Check logout and revocation behavior.
- Compare access permissions between two synthetic user accounts.
- Assess certificate validation in the test build.
- Document the backend's actual enforcement behavior.
5. Lab environment
Tool β Purpose
JADX β Android static analysis
MobSF β Mobile application security analysis
Burp Suite β API traffic inspection
Frida β Authorized runtime instrumentation
Python β Token and API test automation
Android Emulator β Controlled test device
References:
6. Practical lab demonstration
Use an application you own with two synthetic users.
Example JWT payload for educational inspection:
{
"iss": "https://auth.lab.local",
"sub": "user-1001",
"aud": "mobile-api",
"scope": "profile:read",
"iat": 1795400000,
"exp": 1795403600
}{
"iss": "https://auth.lab.local",
"sub": "user-1001",
"aud": "mobile-api",
"scope": "profile:read",
"iat": 1795400000,
"exp": 1795403600
}This is illustrative data, not a real token.
Questions to investigate:
- Does the API validate
iss? - Does it validate
aud? - Does it reject expired tokens?
- Are scopes enforced on individual endpoints?
- Can a token issued for one service be reused at another?
- Does revocation invalidate the expected session?
Example API request:
GET /api/v1/profile HTTP/1.1
Host: api.lab.local
Authorization: Bearer <LAB_ACCESS_TOKEN>
Accept: application/jsonGET /api/v1/profile HTTP/1.1
Host: api.lab.local
Authorization: Bearer <LAB_ACCESS_TOKEN>
Accept: application/json7. Safe Python token inspection
import base64import jsondef decode_jwt_payload(token): parts = token.split(".") if len(parts) != 3: raise ValueError("Invalid JWT structure") payload = parts[1] payload += "=" * (-len(payload) % 4) decoded = base64.urlsafe_b64decode(payload) return json.loads(decoded)# Use a synthetic, non-production JWT.claims = decode_jwt_payload( "LAB_HEADER.LAB_PAYLOAD.LAB_SIGNATURE")for claim in ("iss", "sub", "aud", "exp", "scope"): print(f"{claim}: {claims.get(claim)}")import base64import jsondef decode_jwt_payload(token): parts = token.split(".") if len(parts) != 3: raise ValueError("Invalid JWT structure") payload = parts[1] payload += "=" * (-len(payload) % 4) decoded = base64.urlsafe_b64decode(payload) return json.loads(decoded)# Use a synthetic, non-production JWT.claims = decode_jwt_payload( "LAB_HEADER.LAB_PAYLOAD.LAB_SIGNATURE")for claim in ("iss", "sub", "aud", "exp", "scope"): print(f"{claim}: {claims.get(claim)}")Critical distinction: This code only decodes the payload. It does not verify the signature, issuer, audience, expiration, or authorization. Those checks must be performed by the actual resource server.
8. Technical analysis
Investigate these scenarios:
- Refresh token accepted repeatedly when rotation is expected.
- Logout that clears the client but not the server session.
- Incorrect audience validation.
- Overly broad OAuth scopes.
- Weak redirect URI matching.
- Sensitive tokens stored in insecure locations.
- Mobile applications relying on client-side role checks.
9. Detection and mitigation
- Enforce PKCE for authorization code flows.
- Use exact redirect URI matching.
- Validate token signatures and claims.
- Restrict audience and scope.
- Rotate refresh tokens where appropriate.
- Detect refresh-token reuse.
- Avoid embedding permanent secrets in mobile binaries.
- Use platform-secure credential storage.
- Validate TLS certificates correctly.
- Apply authorization checks server-side.
C. Security checklist
- Authorization Code + PKCE correctly implemented.
- Redirect URI validation verified.
- Issuer and audience validation confirmed.
- Token expiration enforced.
- Refresh-token lifecycle tested.
- Logout and revocation validated.
- API scopes enforced.
- Cross-user authorization tested.
- Sensitive storage inspected.
- No production secrets included in evidence.