Connect a seller's marketplace account (Poshmark, Mercari, Depop, Vinted, …) to Crossly from your React Native app. The seller signs in inside a WebView whose marketplace traffic goes through that seller's own IP-pinned Crossly proxy, so the session is born on the same IP Crossly later uses it from. OAuth marketplaces open in the system browser instead.
Headless: the component draws only the WebView. Every header, button, message and loading state is yours, through props and render functions. There is no Crossly branding or copy in the package.
Partner access: this SDK needs a Crossly partner key (used server-side only). Request access at https://crossly.net/partners.
A marketplace session that is created on the phone's own IP and then used from a server IP is flagged and dies within hours. So this SDK never opens a marketplace login without the proxy:
- the WebView is mounted only after the relay route is applied natively;
- if the device cannot proxy, the relay is missing, the route cannot be applied or the relay token cannot be
renewed, the login does not open (or is closed) and you get
onResult({ type: 'blocked', reason }); - there is no fallback to a direct connection, and no option to enable one.
Offer another way to connect (e.g. your desktop extension) when canProxy() says no.
| iOS | iOS 17 or later to connect (WKWebsiteDataStore.proxyConfigurations). The app itself installs on iOS 16.4+; canProxy() answers ios_too_old below 17. Each login runs in the SDK's own WKWebView on a brand-new, non-persistent data store with the proxy set before the WebView exists (never your app's default store: WebKit bug 316948 lets a used store bypass a proxy for hosts it already reached), and that store is discarded afterwards. |
| Android | An Android System WebView with PROXY_OVERRIDE and PROXY_OVERRIDE_REVERSE_BYPASS (androidx.webkit). Any current WebView has both; otherwise android_no_proxy_override. |
| Runtime | A development or production build. Not Expo Go (expo_go): the SDK has native code. |
| Expo modules | Expo SDK 52+ (managed or bare). A bare React Native app needs npx install-expo-modules first. |
npx expo install @crossly/connect-react-native react-native-webview @preeternal/react-native-cookie-managerPeer dependencies: react, react-native, expo, react-native-webview (≥ 13),
@preeternal/react-native-cookie-manager (≥ 7, reads the Android WebView's cookie store including HttpOnly cookies; on iOS the SDK reads its own login store).
Expo (managed / CNG) — add the config plugin, then rebuild (npx expo prebuild / EAS build):
{ "expo": { "plugins": ["@crossly/connect-react-native"] } }The plugin raises the iOS deployment target to at least 16.4 if it is lower
(["@crossly/connect-react-native", { "ios": { "deploymentTarget": "17.0" } }] to raise it further).
The native module is linked by Expo autolinking. Bare apps: cd ios && pod install, then rebuild.
your server Crossly your app
----------- ------- --------
POST /v1/partner/sellers/:id/connect-sessions (partner key)
{ platform: 'poshmark' } ─────► provisions the seller's proxy
◄───── ConnectSession JSON
send the ConnectSession to the app ──────────────────────────────► <CrosslyConnect session={...} />
applies the relay, opens the login
POST .../connect-sessions/:id/relay ◄── renews the relay (upload token)
POST .../connect-sessions/:id/cookies ◄── signed-in session (upload token)
webhook connection.active ◄────── verifies the session server-side
- Your partner key never goes to the app. The app only receives the ConnectSession; its
uploadTokenis single-use for/cookies(15 minutes) and reusable for/relay. - Create a new ConnectSession for every attempt. A session whose upload token was used or expired cannot be reused.
- The final word is server-side:
GET /v1/partner/connect-sessions/:idor theconnection.active/connection.failedwebhooks.onResult({ type: 'connected' })means the session was handed over.
import { CrosslyConnect, canProxy, type ConnectSession } from '@crossly/connect-react-native';
import * as WebBrowser from 'expo-web-browser';
function ConnectScreen({ session, onClose }: { session: ConnectSession; onClose: () => void }) {
return (
<CrosslyConnect
session={session}
onResult={(r) => {
if (r.type === 'connected') showToast('Connected');
if (r.type === 'blocked') logReason(r.reason);
if (r.type === 'oauth') pollSessionStatus(r.sessionId);
}}
onError={(err, { auto }) => {
if (!auto) showToast(err.retryable ? 'Not signed in yet — try again' : 'Start over');
}}
renderLoading={() => <MySpinner />}
renderBlocked={({ reason }) => <MyConnectFromComputer reason={reason} onClose={onClose} />}
renderControls={({ confirmLoggedIn, uploading }) => (
<MyFooter onCancel={onClose} onDone={confirmLoggedIn} busy={uploading} />
)}
renderComplete={() => <MyDoneState onClose={onClose} />}
openAuthSession={(url) => WebBrowser.openAuthSessionAsync(url, 'myapp://crossly-connected')}
/>
);
}
// Before offering the button at all:
const { ok, reason } = await canProxy();canProxy(): Promise<{ ok: boolean; reason?: 'ios_too_old' | 'android_no_proxy_override' | 'expo_go' | 'unsupported' }>
<CrosslyConnect> props:
| Prop | |
|---|---|
session |
The ConnectSession from your server (required). A new session.id starts over. |
onResult(r) |
Once per session. { type: 'connected', sessionId, platform, accountId, status, cookieCount } · { type: 'blocked', reason } · { type: 'oauth', outcome: 'completed' | 'dismissed' | 'opened', url? }. |
onError?(err, { auto }) |
Recoverable problems, CrosslyConnectError with code (no_cookies, upload_failed, relay_renewal_failed, oauth_failed, network), status, serverCode, retryable. auto = raised by automatic detection. |
style? |
Outer View style (defaults to flex: 1). |
renderBlocked?({ reason }) |
Shown when the login cannot be opened. reason: a canProxy reason or relay_unavailable, proxy_apply_failed, relay_renewal_failed. |
renderLoading?() |
Shown while preparing, while pages load, and while an OAuth page is open. |
renderControls?(state) |
Rendered below the WebView: { currentUrl, loggedInDetected, uploading, confirmLoggedIn }. Give sellers a "I'm signed in" control calling confirmLoggedIn for when detection misses. |
renderComplete?(result) |
Shown after the hand-over (the WebView is gone). |
clearCookiesFirst? |
Sign the WebView out of everything first — use for a new account so the previous account's session is not reused. On Android this clears your app's whole WebView cookie store; on iOS every login already starts on an empty store. |
autoDetect? |
Upload as soon as a page matches login.loggedInMatchers (default true). |
settleMs? |
Delay between detection and reading cookies (default 1500). |
openAuthSession?(url) |
OAuth sessions: open in an auth session (e.g. WebBrowser.openAuthSessionAsync). Default: Linking.openURL. |
userAgent? |
WebView user agent override (default: the WebView's own, which is what is reported). |
apiBaseUrl? |
Default https://crossly.net/api. |
login.loggedInMatchers are regular-expression sources tested case-insensitively against each page URL; an entry
starting with ! must not match (e.g. ["!login|checkpoint", "facebook\\.com"]). isLoggedInUrl(matchers, url) is
exported for your own checks.
- The proxy route is process-wide on Android (every WebView in your app). On iOS it applies only to the SDK's own
login data store, through an in-app loopback forwarder (below). Only the marketplace's hosts are routed; everything
else stays direct. The route is removed when the component unmounts, is blocked, or finishes. Do not show another
WebView to the same marketplace while
<CrosslyConnect>is mounted. - Loopback forwarder (iOS and Android). WKWebView's proxy authentication is unreliable (WebKit bug 264309; Apple
DTS forum 759417; HTTPS-proxy fixes only in iOS 18), and Android WebView cannot authenticate to an HTTPS proxy at
all (
net::ERR_PROXY_AUTH_UNSUPPORTED), so the WebView never talks to the relay. Each login starts a forwarder inside your app (ios/ConnectLoopbackForwarder.swift,android/.../LoopbackRelayForwarder.kt): it listens on127.0.0.1on a random port, accepts onlyCONNECT <marketplace host>:443for the login's own hosts (403 otherwise, 405 for plain http, at most 32 open tunnels), opens TLS to the Crossly relay, and sends the relay token preemptively asProxy-Authorization: Basic. It never connects anywhere but the relay, and it stops when the login ends. On iOS the login store's proxy is that forwarder (no TLS, no credential,matchDomains= the marketplace's hosts); on Android the process-wide WebView proxy override ishttp://127.0.0.1:<port>with reverse bypass (only the marketplace's hosts use it). Other apps on the phone can reach a loopback port; the forwarder only ever opens this seller's marketplace hosts, for this login's lifetime. - Links that would leave the WebView (app links,
intent:URLs) are refused, so the login cannot escape to an unproxied app or browser. New-window links open in the same WebView. - The relay token never reaches the WebView on either platform: the forwarder holds it, in memory only (never UserDefaults, Keychain or disk). A token renewal swaps it in the running forwarder (new tunnels use it).
- iOS hardening: each loopback connection must send its CONNECT within 5 s; at most 32 tunnels; the listener stops
the moment the login ends. The forwarder's TLS to the relay is pinned: normal trust evaluation for the relay
hostname, then a pinned CA key in the chain (SPKI SHA-256 of ISRG Root X1, X2 and Root YE, the Let's Encrypt chain
the relay serves;
ConnectForwarderRules.relayCAPins). A chain without one fails closed. There is no per-login loopback credential: WebKit does not reliably sendProxy-Authorizationto a proxy (bug 264309). - Android hardening: the forwarder demands its own random per-login credential (SecureRandom) on every CONNECT (407
otherwise), so other apps on the phone cannot use the port. The WebView answers that 407 through
react-native-webview's
basicAuthCredential(which answers any HTTP auth challenge: a page that sent one would see a credential that only works on this phone's loopback, for this login). The relay TLS is pinned the same way as on iOS (RelayPinsinLoopbackRelayForwarder.kt, same three roots, by signature path; rotation steps in the file). After the upload, and whenever the login ends (blocked, unmounted), the session's cookies (cookieDomains+ the login host) are expired in the WebView's CookieManager and flushed. The upload and relay tokens are only in memory (props and component state). - No secret (upload token, relay token, cookies) is logged by the SDK. Do not log the
ConnectSessionyourself.
These cannot be unit-tested and must be verified on real devices before relying on them:
- iOS 17/18:
matchDomainsmatches subdomains (www.depop.comfordepop.com), WebKit reaches the in-app127.0.0.1forwarder with no local-network prompt, and tunnels through the live relay complete. - Android: the proxy override to
http://127.0.0.1:<port>takes effect (no cleartext-policy objection on the loopback hop), the WebView answers the forwarder's 407 viabasicAuthCredential, the pinned TLS to the live relay verifies, a full marketplace login completes through the forwarder, and the cookie purge empties the store. - The cookie manager reads the session cookies (HttpOnly included) for every cookie domain on both platforms.
MIT