Skip to content

Few fixes faced while bette auth mobile integration #174

Merged
Joel-Joseph-George merged 3 commits into
mainfrom
fix/better-auth-mobile-int
Jun 4, 2026
Merged

Few fixes faced while bette auth mobile integration #174
Joel-Joseph-George merged 3 commits into
mainfrom
fix/better-auth-mobile-int

Conversation

@Joel-Joseph-George
Copy link
Copy Markdown
Contributor

Fixes three issues found during React Native integration testing.

  1. Trusted origin error Axios sets Origin to the server's LAN IP, which BetterAuth rejected. trustedOrigins now dynamically trusts the origin of any request carrying valid mobile identity headers (x-client-type: mobile + user-agent: fluent-mobile).

  2. Bearer token session bleed A stale session cookie from a previous login was overriding the Bearer token in subsequent requests. The authenticate middleware now strips cookies when a Bearer header is present, enforcing token priority.

  3. Sign-out 500 for mobile clients BetterAuth's built-in sign-out ignores Bearer tokens entirely, causing a crash. Replaced with a custom handler that deletes the session directly from the DB for Bearer requests, falling back to BetterAuth for cookie-based (web) sign-out.

@Joel-Joseph-George Joel-Joseph-George merged commit 9e27e7a into main Jun 4, 2026
1 check passed
@github-actions github-actions Bot deleted the fix/better-auth-mobile-int branch June 4, 2026 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants