◉RORK LABJP
●GPT-6.1 SOL — Added to Rork's model menu (09-29) with Low, Medium and High effort; included on Pro and Max●SONNET 5.5 — Claude Sonnet 5.5 is selectable: strong at UI design and faster than Sonnet 5 (09-28)●SDK 58 — Beta since 09/15 with no stable date yet; running projects in Expo Go has required login since 09/03●WIDGET — A write-up traces an iOS widget that renders black only in production builds●OBSERVE — EAS Observe now records native crashes too (SDK 57.0.21 or later, 10/07)●NEW — My App Open Ad Only Showed When the App…●GPT-6.1 SOL — Added to Rork's model menu (09-29) with Low, Medium and High effort; included on Pro and Max●SONNET 5.5 — Claude Sonnet 5.5 is selectable: strong at UI design and faster than Sonnet 5 (09-28)●SDK 58 — Beta since 09/15 with no stable date yet; running projects in Expo Go has required login since 09/03●WIDGET — A write-up traces an iOS widget that renders black only in production builds●OBSERVE — EAS Observe now records native crashes too (SDK 57.0.21 or later, 10/07)●NEW — My App Open Ad Only Showed When the App…
Articles/Dev Tools
⬡ Dev Tools/2026-05-03Advanced

Sign in with Apple in Rork: Server-Side Verification, Account Linking, and the Mandatory Deletion Flow

A Sign in with Apple button that only lives on the client tends to fray on the server before it ever fails review. This guide builds the rest on Cloudflare Workers: a server-issued nonce, ID token verification, prompt authorizationCode exchange, an account deletion flow that revokes properly, and Apple's server-to-server notifications.

Sign in with AppleAuthentication8JWT3App Store Review8Cloudflare Workers25

✦ Premium Article

The part of the nonce check that stalled me longest wasn't the cryptography. It was a plainer question: who creates the nonce in the first place? I had written server code that looked up a value the client had made up itself, asking whether it had been "issued." Read back later, the two halves never fit together.

Dropping in the button takes ten minutes. Verifying the ID token on the server, and telling Apple to let go when an account is deleted, turns it into a small authentication system. The screens Rork generates usually cover the first half, and the second half is yours to fill in. In hindsight, the thing to settle before any cryptographic detail was where each value comes from.

Here we'll use expo-apple-authentication on the client and Cloudflare Workers (Hono and D1) on the server, and walk through nonce issuance, ID token verification, authorizationCode exchange, a deletion flow that revokes, and Apple's notifications. The same ideas carry over to Vercel Edge Functions or AWS Lambda.

What review actually looks at

Rejection notes are rarely uniform, and you often end up working out for yourself what was missing. Let me pin down the relevant guidelines first. The wording gets revised, so please check the current App Store Review Guidelines before you rely on any paraphrase here.

  • 4.8 (Login Services): If your app uses a third-party or social login, you need to offer an equivalent, privacy-minded login option alongside it. Since the January 2024 revision, the text is written around conditions rather than around Sign in with Apple by name: the service limits collection to name and email, lets users keep their email private, and doesn't track app activity for advertising without consent. Sign in with Apple is the most convenient way to meet those conditions. Apps that only use their own account system are out of scope
  • 5.1.1(v) (Account deletion): If your app lets people create an account, it must let them delete it from inside the app. This has been mandatory since June 30, 2022, and for Sign in with Apple users it also expects you to revoke their tokens through the Sign in with Apple REST API when deletion starts. As far as I know there is no numeric rule such as "within three taps"; the standard is that the entry point is easy to find
  • ID token verification: Apple's documentation lays out a procedure for verifying the JWS signature and claims on your server. Trusting values the client hands you and writing them straight into your database skips that procedure

One more practical note: expo-apple-authentication is awkward to test in Expo Go and needs the native entitlement. Turn on ios.usesAppleSignIn in app.json, enable Sign in with Apple on the App ID in Apple Developer, and rebuild your development client. I've written up that rebuild in the Expo Dev Client setup guide.

The big picture: four layers, five values

Settling roles up front makes later debugging far easier.

  • Layer 1, the screen (React Native generated by Rork): renders the button, calls signInAsync(), and receives identityToken and authorizationCode
  • Layer 2, client preprocessing: fetches a nonce from the server, hashes it with SHA-256, and hands the hash to Apple
  • Layer 3, server verification (Workers + Hono): consumes the nonce, verifies the ID token, exchanges the authorizationCode, and issues your own session
  • Layer 4, deletion and notifications: revokes on account deletion and handles the server-to-server notifications Apple sends

Five values travel through those layers, and they live for different lengths of time. This table shows where each one ends up.

ValueCreated byGoes toLifetime and handling
raw nonceServerHanded to the client, returned for verification5 minutes, single use
hashed nonceClientPassed to Apple, appears in the ID token's nonce claimNot stored
identityTokenAppleVerified on the server (signature and claims)Discard after verifying
authorizationCodeAppleExchanged on the server for a refresh_token5 minutes, single use
refresh_tokenApple (result of the exchange)Stored encrypted in D1Kept until you revoke it on deletion

The detail that authorizationCode expires in five minutes and works only once is easy to miss. If you try to exchange it after you've already returned the login response, it's often too late.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦You'll see how to issue the nonce on the server and make it single-use, consuming it atomically with D1's DELETE ... RETURNING
✦You'll wire ID token verification (jose), the five-minute authorizationCode exchange, and encrypted refresh_token storage into one working flow
✦You'll implement the 5.1.1(v) account deletion as a two-phase delete that survives a failed revoke, and receive Apple's server-to-server notifications
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

⬡ Dev Tools2026-05-23
Auditing Privacy Manifests for Rork-Generated Expo Apps — A One-Day Pre-Submission Workflow for Indie Developers
A pre-submission workflow for indie developers shipping Rork-generated Expo apps: enumerate every dependency, tell ITMS-91053 apart from ITMS-91061, and catch the Pods that npm names never show you — hermes included.
⬡ Dev Tools2026-05-09
Building a Rork A/B Testing Platform with GrowthBook and PostHog from Scratch
Drop Firebase and pair GrowthBook with PostHog to ship a production-grade A/B testing stack for your Rork apps. SDK wiring, edge evaluation on Cloudflare Workers, Bayesian statistics interpretation, and the operational pitfalls I learned the hard way.
⬡ Dev Tools2026-04-30
Rork × AI Moderation Production Guide: Reporting, Auto-Review, and Tiered Sanctions for UGC Apps
A complete production-grade guide to layering AI moderation, reporting, and tiered sanctions into your Rork UGC app. Includes a working three-layer pipeline using OpenAI Moderation, Perspective API, and Cloudflare Workers Queues.