Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: fa311e9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
This was referenced Sep 27, 2026
mikepitre
force-pushed
the
mike/expo-native-sync-bridge
branch
from
September 28, 2026 19:35
17b87b7 to
8ad6eb2
Compare
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
mikepitre
force-pushed
the
mike/expo-native-sync-bridge
branch
from
September 28, 2026 20:23
8ad6eb2 to
fa311e9
Compare
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Stacked on #9955. Adds the native half of the single-token client sync to
@clerk/expo-native-components. The JS engine that consumes it lands in #9956.The native SDK's stored device token is the only token. JS reads it before each FAPI request and writes rotated tokens back with compare-and-set. Both sides exchange payload-free invalidations and each refetches its own client.
The change is additive.
configure,getClientToken,syncClientStateFromJs, andclerkNativeClientChangedstill behave as before, so the current JS engine keeps working. The JS engine PR removes them later. Auth-flow and biometric functions are untouched.New module surface (iOS and Android):
configureNative(publishableKey, seedDeviceToken): Promise<void>: configures the SDK with today's options (keychain service and host SDK header on iOS; foreground refresh disabled and custom headers on Android). If native has no stored token, it adopts a non-empty seed with compare-and-set againstnull. Otherwise native keeps its own token. It resolves without waiting for the client to load. Calling it again with the same key is a no-op. A different key goes throughClerk.reconfigure/Clerk.switchConfiguration, asconfiguredoes today. After adopting a seed it starts a backgroundrefreshClient(), so native loads the seeded client even if its initial load was fenced off by the token change. It does not emitclerkNativeClientInvalidated: the baseline is taken after configuration and seed adoption. It is namedconfigureNativeto avoid clashing with the existingconfigure. The JS engine PR can rename it once the old path is gone.getDeviceToken(): Promise<string | null>:Clerk.shared.deviceToken/Clerk.getDeviceToken(). Resolvesnullbefore configuration.setDeviceToken(token, expected): Promise<boolean>:Clerk.shared.setDeviceToken(_:expected:)/Clerk.setDeviceToken(token, expected). Rejects withE_NOT_CONFIGURED,E_INVALID_DEVICE_TOKEN(empty or blank token),E_CANCELLED(iOS only) orE_SET_DEVICE_TOKEN_FAILED.refreshClient(): Promise<void>: rejects withE_NOT_CONFIGUREDorE_REFRESH_CLIENT_FAILED.clerkNativeClientInvalidatedevent, with no payload. It fires when this fingerprint of native state changes: client id,lastActiveSessionId, each session's id and status, the active user's id andupdatedAt, and the device token. Changes are coalesced to at most one event per main-loop turn, and a change that reverts within the same turn is not emitted. A token that JS itself wrote with a successfulsetDeviceTokenis not echoed back as an invalidation. That echo would make JS refetch after every rotation.Clerk.shared.clientwithwithObservationTracking. It also re-checks the fingerprint aftersetDeviceTokenandrefreshClient, becausedeviceTokenitself is not observable.Clerk.clientFlowand re-checks the token on every emission and aftersetDeviceToken/refreshClient. clerk-android has no public token-change listener.The JS
Spec/ClerkExpoNativeModuletypes in@clerk/expogain these functions as optional members, so the current engine still type-checks.SDK dependencies: this needs the unreleased framework compare-and-set APIs from clerk/clerk-ios#583 and clerk/clerk-android#964.
ClerkExpo.podspecpins clerk-ios to themike/framework-set-device-tokenbranch. It must be switched back to an exact released version before merge.build.gradlestill declares clerk-android1.1.9, which does not haveClerk.setDeviceToken. The Android build needs clerk-android#964 released, and the version bumped, before merge. Until then the Android native build in CI will fail. It was compiled locally against amavenLocalsnapshot of that branch.Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
🤖 Generated with Claude Code