Reconstructing token generation from an APK
The login is the entry point, but the token is the state the app leaves behind and later proves.
Request reconstruction · signing
A copied request can fail because its signature, session or replay state no longer matches the server. Compare the exact bytes and response before changing headers. Then test each dependency with a known working request.
A capture records the method, path, headers and body sent on one call. It does not explain how the app created those values or whether the server will accept them again. Record the response too: a captured request is not proof of a successful call.
Check timestamps, nonces, session tokens, device values and the signature covering them. Preserve the query encoding and body bytes. Two JSON objects can contain the same fields while producing different signatures.
Compare the capture with a fresh successful app request. Check these dependencies against the implementation and response.
Date header does not establish that rule.Start from a fresh working request and change one dependency per test. Recompute the signature whenever a signed input changes, while keeping the other inputs fixed. Reset the test session or nonce state between comparisons so an earlier test does not consume the next test's input.
A changed status narrows the investigation; it does not identify the cause by itself. Compare response details, generated bytes and the app's request builder. The owned fixture below has explicit error names so each result can be checked. Those names and its 30-second window are fixture rules, not claims about a real app.
# Download replay-check.py using the link below, then run: python3 replay-check.py # Expected output: # timestamp: timestamp expired -> accepted # nonce: nonce already used -> accepted # body bytes: signature mismatch -> accepted # repeat: accepted -> nonce already used
Download the Python replay fixture. It uses only the Python standard library, makes no network calls and checks every result with assertions. The timestamp and public key are fixed test values.
Once you know which fields regenerate, find where the app computes them. The signing logic is usually in an interceptor (OkHttp, Retrofit), in a helper class, or in a native library. The nonce and timestamp generation is often right next to it. Read what the app signs, in what order, with what encoding, and rebuild that exact operation.
def sign(request):
prefix = f"POST\n/catalog\n{request.timestamp}\n{request.nonce}\n".encode()
signature = hmac.new(KEY, prefix + request.body, hashlib.sha256).hexdigest()
return replace(request, signature=signature)
The fixture signs the exact body bytes after the method, path, timestamp and nonce. A real app can use different fields, separators, encoding and key sources. Recover those rules rather than applying this format to every API.
| Status / behavior | What it points to | Where to look |
|---|---|---|
| 403 with a generic body | The server understood and refused the request. The status alone does not name the fault. | Compare the response body, then re-sign and test before attributing it to signing. |
| 401 | Missing or invalid authentication credentials. | Check the challenge, response body and session flow; the status does not prove expiry or device binding. |
| 409 or "duplicate" | A conflict with current state; replay is one possible application rule. | Confirm the error meaning before changing nonce generation. |
| Works in the app, 403 in Python | The two executions differ in bytes, state or transport context. | Compare the request and session before naming the blocked dependency. |
After rebuilding the request, test a fresh login or session, the next call and the refresh path. Record which app version and workflows passed. A matching HMAC proves one byte-level calculation; it does not prove the whole integration works.
For a second tested implementation, compare the Swift and TypeScript signing fixture. For an existing client that broke, use API integration repair.
Reviewed 17 October 2026 · SReverse
Each page below takes one reason a replayed request stops working and shows how to confirm it and rebuild the value the app computes. Start with the symptom you have.
The login is the entry point, but the token is the state the app leaves behind and later proves.
An empty Java method is not empty once the logic lives in a native library.
Base URLs hide in the dex, in resources, or behind native code.
Relevant capability
When a replayed request fails, the deliverable is the working request layer, not a longer list of captured requests. Request signing
Start a project
We rebuild the complete application flow and return the full API in Python, JavaScript/TypeScript, Postman and complete API documentation.