Business · Product · Technology · AI

Keep Apple credential revocation separate from local account deletion

A Movo-X account-lifecycle case tracing authorization-code exchange, generated client secrets, sealed refresh tokens, deferred revocation and provider outcome boundaries.

Work directly with Omer Muneer Qazi · Reviewed 29 November 2026

The scenario: deletion spans two independent systems

An application can remove an account locally while an external identity provider still recognizes an authorization grant. Those are different state changes, with different credentials and failure modes. A useful deletion design explains both the local user journey and the provider-side operation without treating one response as proof that every copy or session disappeared.

The inspected Movo-X source exchanges an optional Apple authorization code, seals a returned refresh token and later drains queued revocation work. Four selected existing and four supplemental local cases passed. They use generated signing keys, synthetic tokens, injected endpoints and fake database responses; no actual account was deleted or provider token revoked.

Generate the client secret for the intended client identifier

The client-secret builder signs selected issuer, audience, subject and time claims as an ES256 JWT. An existing fixture fixes the clock, inspects those claims and verifies the signature using the generated public key. This proves the selected local JWT construction rather than Apple recognizing the key identifier or developer team.

The supplemental loader case distinguishes absent configuration, incomplete configuration and a generated key on the wrong curve. The allowed generated P-256 key passes. Actual key custody, platform registration and deployed configuration were not verified, and no existing signing key was read for these tests.

Separate identity-token verification from code exchange

The sign-in route first follows the identity-token verification path discussed in the companion chapter. When a code and configured Apple key are present, the exchange helper submits a form to the fixed token endpoint. The selected fixture checks its client identifier, grant type and supplied code.

The response helper compares the returned token’s subject with the already verified subject and retains only the selected refresh-token value. It does not independently repeat full signature verification of that response token in this helper. The inspected trust boundary is the configured endpoint response; the fixture’s invented response is not a real authorization-code validation.

Refuse selected unusable responses without inventing a stored credential

Existing and supplemental exchange cases refuse a subject mismatch, malformed response token, absent refresh token, selected short token and a provider refusal. The source also catches transport or parsing failures and returns no refresh token. The sign-in route’s policy permits sign-in to continue when that optional exchange fails.

That policy creates a distinct operating state: an identity can exist without retained revocation material. Apple’s technical note discusses deletion handling when credentials for programmatic revocation are unavailable. This review does not claim that the application’s complete fallback user journey or all current platform expectations have been accepted.

Seal retained tokens with authenticated encryption

The sealing helper creates a new random initialization vector and uses AES-256-GCM under a purpose-derived key. A supplemental case seals the same invented refresh token twice, observes different envelopes and successfully opens both. Selected modifications to the initialization vector, authentication tag and ciphertext are refused.

Existing and supplemental cases also refuse a different secret or unsupported envelope version. Those tests demonstrate selected confidentiality/integrity mechanics at this helper boundary. They do not establish production secret entropy, access controls, backup retention or a managed key-rotation process. No real provider credential was placed in the fixture or public content.

Preserve decryptability as an operational dependency

The source derives the sealing key from the patient hash secret. Changing that secret without a compatible migration can make retained envelopes unreadable. The passing wrong-secret case demonstrates that dependency; it is not evidence that such a change has occurred in production.

The deferred-drain supplemental case supplies an unreadable invented envelope and observes a local invalid/unreadable result without any provider request. That classification must not be reported as an observed provider revocation. A migration and recovery plan should distinguish local unreadability, provider rejection, accepted revocation and any required user-assisted recovery.

Treat deferred cleanup as scheduled work rather than completed deletion

The route source schedules a bounded revocation drain only when the key, adapter and deferral mechanism exist. The supplemental fixture records no adapter call before the deferred function runs; removing the deferral dependency schedules nothing. The existing sign-in/deletion fixture explicitly executes its captured deferred tasks.

That existing case observes the synthetic sealed value reaching the fake lease and the decrypted value reaching an injected revoke request. Selected fake database calls and logs omit the raw token. It does not prove that a hosting runtime always preserves deferred work, that a queue is durably drained or that the provider changed a real grant.

Keep provider classification and durable queue state distinct

The revocation helper classifies selected successful responses, selected invalid-request/grant responses and retry conditions. Supplemental input checks reduce an arbitrary error message to a bounded HTTP code rather than returning its free-form text. The existing fixture also checks transport failure.

Selected SQL defines leasing, retry backoff, terminal outcomes and clearing stored ciphertext. Those branches were reviewed without executing the database. An emitted outcome is not proof that the lease result persisted under concurrency. Likewise, a terminal local classification does not by itself establish App Store acceptance, account erasure across all systems or an observed device sign-out.

A reviewable account-lifecycle acceptance package

Keep the generated-key signature, response refusal, sealing/tamper, deferred-order and provider-classification cases. Add database queue tests, secret-migration rehearsals and a controlled Apple account exercise that records authorization, local deletion, provider revocation and resulting client state independently. Ensure the credential-unavailable path has an owner and observable outcome.

For a CTO, the engineering value lies in explicit dependencies and failure states. The selected local cases make credential handling and adapter policy inspectable. Current developer-account access, real provider revocation, durable queue recovery and the complete deletion experience remain separate acceptance work.

Compare the reviewed boundaries

Deletion and revocation observations

On smaller screens, scroll across to compare every column. Keyboard users can focus the table and use the arrow keys.

EventSelected evidenceSeparate fact
Envelope openedGenerated-token encryption testsCurrent secret custody and migration
Deferred task executedExplicit fixture callback executionRuntime scheduling durability
Provider classifiedInjected HTTP outcomeReal Apple grant state
Queue result emittedFake adapter inputCommitted terminal state

Illustrative control flow

Pseudocode summarizing the decision boundary. It is not copied production code or a deployment instruction.

identity = verify_existing_apple_identity_token()
refresh = optionally_exchange_code_for_same_subject(identity)
if refresh:
    store_sealed_refresh_envelope(refresh)

# Later: local deletion and provider revocation are distinct operations.
lease = obtain_pending_revocation()
record_actual_provider_or_local_failure_observation(lease)

Additional implementation references

These provider references explain current implementation context. Historical Movo-X observations remain tied to the source records described above.

About this engineering series

Written by Omer Muneer Qazi from a review of Movo-X implementation and dated engineering records. This article explains source behaviour and historical observations; current production, clinical outcomes and store availability require their own verification. Examples are synthetic and proposed test cases are identified as such.

Explore the Movo-X engineering series → · Related implementation experience →

Discuss a similar engineering problem

Send the workflow, current platform and the decision your team needs to make. I can help define an implementation or review scope with concrete acceptance evidence.

Discuss your project on WhatsApp ↗
WhatsApp Omer about this project ↗