[PR #4990] [CLOSED] fix(oauth-proxy): should skip state check for oauth proxy #22598

Closed
opened 2026-04-15 21:09:42 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4990
Author: @Bekacru
Created: 9/30/2025
Status: Closed

Base: canaryHead: fix/oauth-proxy


📝 Commits (10+)

📊 Changes

91 files changed (+6005 additions, -1455 deletions)

View changed files

demo/expo-example/.env.example (+7 -0)
demo/expo-example/.gitignore (+20 -0)
demo/expo-example/README.md (+15 -0)
demo/expo-example/app.config.ts (+55 -0)
demo/expo-example/assets/bg-image.jpeg (+0 -0)
demo/expo-example/assets/fonts/SpaceMono-Regular.ttf (+0 -0)
demo/expo-example/assets/icon.png (+0 -0)
demo/expo-example/assets/images/adaptive-icon.png (+0 -0)
demo/expo-example/assets/images/favicon.png (+0 -0)
demo/expo-example/assets/images/logo.png (+0 -0)
demo/expo-example/assets/images/partial-react-logo.png (+0 -0)
demo/expo-example/assets/images/react-logo.png (+0 -0)
demo/expo-example/assets/images/react-logo@2x.png (+0 -0)
demo/expo-example/assets/images/react-logo@3x.png (+0 -0)
demo/expo-example/assets/images/splash.png (+0 -0)
demo/expo-example/babel.config.js (+9 -0)
demo/expo-example/components.json (+6 -0)
demo/expo-example/index.ts (+1 -0)
demo/expo-example/metro.config.js (+39 -0)
demo/expo-example/nativewind-env.d.ts (+3 -0)

...and 71 more files

📄 Description

fixes #4985


Summary by cubic

Fixes OAuth Proxy callbacks by skipping the state cookie check when requests are proxied, restoring cross-domain OAuth flows. Also adds an Expo authorization proxy and a new Expo demo to validate the flow end-to-end. Addresses #4985.

  • Bug Fixes

    • OAuth Proxy: skip state cookie validation on proxied flows; only applied when proxying (not when baseURL equals productionURL).
    • Supports an x-skip-oauth-proxy header to bypass proxy logic when needed.
    • Centralized state cookie creation/validation in the OAuth2 state helper; updated tests across plugins and providers.
  • New Features

    • Expo: added /expo-authorization-proxy endpoint and updated client to use it during Browser.openAuthSessionAsync.
    • New Expo demo app showcasing Better Auth with Expo Router, social login, and secure storage.
    • Docs: updated OAuth Proxy guide to note the state check skip and its dev/staging implications.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/4990 **Author:** [@Bekacru](https://github.com/Bekacru) **Created:** 9/30/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `fix/oauth-proxy` --- ### 📝 Commits (10+) - [`825f8e1`](https://github.com/better-auth/better-auth/commit/825f8e1d7ca9eba91e8b80acce491684c9437692) init - [`b2ddc0c`](https://github.com/better-auth/better-auth/commit/b2ddc0c1b484ecf555d7f7a30c9d3e72313eb962) blog - [`22cd9f0`](https://github.com/better-auth/better-auth/commit/22cd9f0c95626a0c525753e4e51d2d53e115464e) chore: dotenv - [`42af8f8`](https://github.com/better-auth/better-auth/commit/42af8f81d13d1ea808928b1d714a1606d5666fe9) update - [`7af508e`](https://github.com/better-auth/better-auth/commit/7af508ee908f764ee9458f6bc9eeb6ab4c825d6d) some update - [`1be889b`](https://github.com/better-auth/better-auth/commit/1be889bb831c879474bdc51cdf96264a13b666a5) docs: add mentions - [`8bc6b18`](https://github.com/better-auth/better-auth/commit/8bc6b18c702b70c9919d27840420e50bd6c61d5e) updates - [`8aeb9b0`](https://github.com/better-auth/better-auth/commit/8aeb9b018835ff93cec8ed6eb837a0a3523ea2aa) chore: use tsconfig monorepo setup (#4826) - [`a3baacb`](https://github.com/better-auth/better-auth/commit/a3baacb148ee8120a19641f6442f993037354f20) docs: change banner - [`d007bda`](https://github.com/better-auth/better-auth/commit/d007bdac99ad626ec8233b32eeedd5bb3de036cb) docs: add link to auth.js team announcement ### 📊 Changes **91 files changed** (+6005 additions, -1455 deletions) <details> <summary>View changed files</summary> ➕ `demo/expo-example/.env.example` (+7 -0) ➕ `demo/expo-example/.gitignore` (+20 -0) ➕ `demo/expo-example/README.md` (+15 -0) ➕ `demo/expo-example/app.config.ts` (+55 -0) ➕ `demo/expo-example/assets/bg-image.jpeg` (+0 -0) ➕ `demo/expo-example/assets/fonts/SpaceMono-Regular.ttf` (+0 -0) ➕ `demo/expo-example/assets/icon.png` (+0 -0) ➕ `demo/expo-example/assets/images/adaptive-icon.png` (+0 -0) ➕ `demo/expo-example/assets/images/favicon.png` (+0 -0) ➕ `demo/expo-example/assets/images/logo.png` (+0 -0) ➕ `demo/expo-example/assets/images/partial-react-logo.png` (+0 -0) ➕ `demo/expo-example/assets/images/react-logo.png` (+0 -0) ➕ `demo/expo-example/assets/images/react-logo@2x.png` (+0 -0) ➕ `demo/expo-example/assets/images/react-logo@3x.png` (+0 -0) ➕ `demo/expo-example/assets/images/splash.png` (+0 -0) ➕ `demo/expo-example/babel.config.js` (+9 -0) ➕ `demo/expo-example/components.json` (+6 -0) ➕ `demo/expo-example/index.ts` (+1 -0) ➕ `demo/expo-example/metro.config.js` (+39 -0) ➕ `demo/expo-example/nativewind-env.d.ts` (+3 -0) _...and 71 more files_ </details> ### 📄 Description fixes #4985 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes OAuth Proxy callbacks by skipping the state cookie check when requests are proxied, restoring cross-domain OAuth flows. Also adds an Expo authorization proxy and a new Expo demo to validate the flow end-to-end. Addresses #4985. - **Bug Fixes** - OAuth Proxy: skip state cookie validation on proxied flows; only applied when proxying (not when baseURL equals productionURL). - Supports an x-skip-oauth-proxy header to bypass proxy logic when needed. - Centralized state cookie creation/validation in the OAuth2 state helper; updated tests across plugins and providers. - **New Features** - Expo: added /expo-authorization-proxy endpoint and updated client to use it during Browser.openAuthSessionAsync. - New Expo demo app showcasing Better Auth with Expo Router, social login, and secure storage. - Docs: updated OAuth Proxy guide to note the state check skip and its dev/staging implications. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-15 21:09:42 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#22598