SReverseby Simpa Labs

Replay diagnosis

Why a captured request returns 401 outside the app

The 401 is the server telling you it did not accept the identity attached to the request. Replayed traffic carries several credentials at once, and the one that failed is rarely the field you were editing.

What a 401 means on a replayed request

HTTP defines 401 as a request that lacks valid authentication credentials for the target resource. A 403 means the server understood the request and refused it. Read the response body and WWW-Authenticate header with the status. A gateway or app server can return the same code for several checks.

The distinction decides where to look first. Start a 401 review with the credentials and challenge. Start a 403 review with the response details and access rules. Neither code proves whether a signature, timestamp or device check ran, or which component rejected the request. Replay 4xx triage sets out the full decision table.

The credentials a replayed request carries

One captured request can carry more than one form of identity, and the server applies them in an order you cannot see.

  • A bearer token expires on the server's schedule. A token copied from a capture stops working when its lifetime ends, and the header looks identical before and after it stops working.
  • Refresh changes session state. Check whether refresh retires the old access token, rotates the refresh token or leaves an overlap window. Record the app's actual rules before reusing a captured credential.
  • A signed request carries its own proof of identity. When the signature covers a stale timestamp, the server can reject the request before it ever examines the token, and choose its own error response. Check the response details before assigning the failure to the token.
  • Device binding ties a token to one installation. A token issued to the app is refused when the request arrives without the values the server recorded at issue time.
  • Missing custom headers can surface as 401. Some servers answer a request that lacks a required header with 401 rather than 400, which makes a formatting mistake look like a login failure.
  • Cookie state is easy to lose. Keep login cookies and send them on requests covered by their domain, path and session rules. Compare the app's actual cookie use with the client.

Tell the credential failures apart

Use three controlled comparisons to narrow the cause.

  • Replace the token with a deliberately invalid one. Compare the status, body and challenge with the original response. A changed response is a lead to test against server logs or app behavior. An unchanged response does not reveal the order of checks.
  • Compare two safe reads with no edits. A first success followed by a failure makes one-time values, session changes and rate limits worth checking. Use read-only calls or a test environment for this comparison.
  • Log in from the script instead of replaying a token. Compare a fresh login with the captured session. Record all changed headers, cookies and tokens so the result stays tied to the tested workflow.

Run the experiments in that order. Keep the request and account state fixed while changing one input. Use the results to choose the next check. Android API 401 and 403 replay covers the same sequence on the service side.

Rebuild the session in order

Replaying a single captured request rarely works for long, because the credential in it belongs to a session that has moved on. Reproduce the session instead: call the login endpoint, keep the token it returns, call the refresh endpoint on the same schedule the app uses, and let every later request take its credential from that state.

A session module that owns the token makes this automatic. It refreshes using the app's token rules and records the response details. Retry a failed call only after checking that repeating it is safe; a payment or other state change needs a status check or an idempotency rule first. When the server rotates refresh tokens, save the replacement together with the access token and prevent two workers from refreshing the same session at once.

Store the token in one object and hand it to the transport rather than writing it into individual calls. A single owner makes the refresh path testable, and it turns an expiry failure into a visible event instead of a request that quietly reuses a retired credential.

When the credential cannot be copied

Some tokens are useless away from the device that obtained them, because the server also checks evidence that the device produced. That case needs its own treatment, since no amount of token handling will satisfy it. Device-bound API reverse engineering describes the options, including reproducing the check rather than copying its output.

Reviewed 19 October 2026 · SReverse research desk

Start your full APK reconstruction

Send the full APK

Projects start at $70. Choose WhatsApp or email, then attach the APK in the app that opens. We reply within one hour with the next step and send the fixed quote after review.

Want us to contact you?