Skip to content

refactor(expo): extract shared FAPI request helpers and app identifier lookup - #10832

Open
wobsoriano wants to merge 2 commits into
mainfrom
rob/mobile-450-expo-extract-fapi-helpers
Open

wobsoriano wants to merge 2 commits into
mainfrom
rob/mobile-450-expo-extract-fapi-helpers

Conversation

@wobsoriano

Copy link
Copy Markdown
Member

Description

Session transfer in #10767 needs the same FAPI response handling that hosted auth already does. Hosted auth keeps it private in utils/hostedAuth.ts, along with the app identifier lookup in useHostedAuth. Session transfer would have to copy both.

This PR moves that code into two shared modules, with no change to hosted auth.

  • utils/fapiRequest.ts has the response helpers. They turn an error response into a ClerkAPIResponseError with its status, errors, and Retry-After, check the response object type, and retry once after a signed_out 401.
  • utils/appIdentifier.ts has getExpoAppIdentifier, which reads the iOS bundle identifier or Android package from the app config.

Hosted auth now imports both. The requests it sends, the errors it throws, and its retry are the same as before. #10767 is the second user, and #10825 is stacked on it.

There is no changelog entry, because nothing changes for apps.

The existing hosted auth tests pass unchanged. I have not rerun hosted auth on a simulator or emulator for this PR.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

🤖 Generated with Claude under Rob's supervision.

Part of MOBILE-450

@vercel

vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
clerk-js-sandbox Ready Ready Preview Nov 16, 2026 5:19am UTC
swingset Ready Ready Preview Nov 16, 2026 5:19am UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ab2bb07

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Expo hook now imports a shared app identifier utility. New FAPI types and helpers provide signed-out retry handling, response extraction, and API error conversion. Hosted auth uses these shared helpers in place of local response and error handling code.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • clerk/javascript#10767: This PR also extracts FAPI request helpers from utils/hostedAuth.ts into a shared utility module.

Suggested reviewers: seanperez29

Merge Risk: Minimal · up to ab2bb

This is a behavior-preserving refactor that moves shared request and app identifier code out of hosted auth. No concrete defect was found, so the merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: extracting shared FAPI request helpers and the app identifier lookup out of hosted auth. The changeset covers both moves in utils/fapiRequest.ts and utils/appIdentifie…
Description check Passed The description states the purpose: session transfer in #10767 needs the FAPI response handling and app identifier lookup that hosted auth already has. It names both new modules, their helpers, and th…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: extracting shared FAPI request helpers and the app identifier lookup out of hosted auth. The changeset covers both moves in utils/fapiRequest.ts and utils/appIdentifier.ts, and hosted auth now imports them. The title is specific and accurate, and it is a single line.

Full details: Description check

Explanation

The description states the purpose: session transfer in #10767 needs the FAPI response handling and app identifier lookup that hosted auth already has. It names both new modules, their helpers, and the hosted auth change. It also reports test results and that no changelog entry is needed. This matches the changeset.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Linked repositories: Some configured repositories could not be included in this review. Cross-repository analysis may be incomplete. Please check linked-repository access and settings.

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 1e13917 and ab2bb07.

Files selected for processing: 5

  • .changeset/thin-eagles-lay.md
  • packages/expo/src/hooks/useHostedAuth.ts
  • packages/expo/src/utils/appIdentifier.ts
  • packages/expo/src/utils/fapiRequest.ts
  • packages/expo/src/utils/hostedAuth.ts
Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. 4 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 10 reviews per hour.

@pkg-pr-new

pkg-pr-new Bot commented Nov 16, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@10832

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@10832

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@10832

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@10832

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@10832

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@10832

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@10832

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@10832

@clerk/expo-biometrics

npm i https://pkg.pr.new/@clerk/expo-biometrics@10832

@clerk/expo-google-signin

npm i https://pkg.pr.new/@clerk/expo-google-signin@10832

@clerk/expo-native-components

npm i https://pkg.pr.new/@clerk/expo-native-components@10832

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@10832

@clerk/express

npm i https://pkg.pr.new/@clerk/express@10832

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@10832

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@10832

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@10832

@clerk/mosaic

npm i https://pkg.pr.new/@clerk/mosaic@10832

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@10832

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@10832

@clerk/react

npm i https://pkg.pr.new/@clerk/react@10832

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@10832

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@10832

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@10832

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@10832

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@10832

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@10832

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@10832

commit: ab2bb07

@blacksmith-sh

blacksmith-sh Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Matches Hosted auth FAPI handling unchanged

All 11 FAPI scenarios produce the same requests, retries and thrown errors before and after; the trace files diff clean.

FAPI scenario trace

Before/after diff empty

Also checked · 1 match · 1 not run

Blocked Hosted auth on a device · Blocked
Matches Default redirect from app identifier unchanged

Note

Proof planned 1 claim but was not able to run it:

Needs the iOS Simulator or an Android emulator

  • Hosted auth on a device

Proof on ab2bb073 · mocked: Frontend API (A scripted FAPI client stub in a vitest harness answers the real useHostedAuth c...) · not run: Expo native app (No iOS Simulator or Android emulator in the Linux sandbox) · Did Proof get it right? Yes · No

View full Proof report · React 👎 or comment @codesmith dismiss this proof to dismiss

@github-actions

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-11-16T05:21:06.043Z

Summary

Metric Count
Packages analyzed 20
Packages with changes 0
🔴 Breaking changes 0
🟡 Non-breaking changes 0
🟢 Additions 0

No API Changes Detected

All packages have stable APIs with no detected changes.


Report generated by Break Check

Last ran on ab2bb07.

This branch was successfully deployed

2 active deployments
Preview – swingset — ab2bb073 Deployed Nov 16, 2026 by vercel[bot]
Preview – clerk-js-sandbox — ab2bb073 Deployed Nov 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant