[PR #2611] [CLOSED] feat(docs): expo -> add baseUrl explanation #4398

Closed
opened 2026-03-13 11:44:20 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/2611
Author: @casperleerink
Created: 5/10/2025
Status: Closed

Base: mainHead: feat/docs/expo-base-url


📝 Commits (1)

  • 032c2ed feat: add accordion to explain base URL in expo

📊 Changes

1 file changed (+97 additions, -72 deletions)

View changed files

📝 docs/content/docs/integrations/expo.mdx (+97 -72)

📄 Description

Hi I got stuck with the expo intergration and it took me a while to figure it out, but the issue is that the baseUrl localhost:8081 (lets pretend thats where your server is), of course doesn't work on the phone (server is not running on the phone)! This pr adds an accordion explanation to help other people get the correct baseUrl with a function.

Especially helpful, since there is no error message for when the server url is not found.

import Constants from "expo-constants";

export const getBaseUrl = () => {
  const debuggerHost = Constants.expoConfig?.hostUri;
  const localhost = debuggerHost?.split(":")[0];

  if (!localhost) {
   // Production
   return "https://[your-better-auth-backend-url]";
  }
  // Development
  return `http://${localhost}:8081`; // this should be the port of your Better Auth backend
};

🔄 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/2611 **Author:** [@casperleerink](https://github.com/casperleerink) **Created:** 5/10/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/docs/expo-base-url` --- ### 📝 Commits (1) - [`032c2ed`](https://github.com/better-auth/better-auth/commit/032c2ed1f444a8f00aa6f2b544039f67dcf32857) feat: add accordion to explain base URL in expo ### 📊 Changes **1 file changed** (+97 additions, -72 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/integrations/expo.mdx` (+97 -72) </details> ### 📄 Description Hi I got stuck with the expo intergration and it took me a while to figure it out, but the issue is that the baseUrl `localhost:8081` (lets pretend thats where your server is), of course doesn't work on the phone (server is not running on the phone)! This pr adds an accordion explanation to help other people get the correct `baseUrl` with a function. Especially helpful, since there is no error message for when the server url is not found. ```ts import Constants from "expo-constants"; export const getBaseUrl = () => { const debuggerHost = Constants.expoConfig?.hostUri; const localhost = debuggerHost?.split(":")[0]; if (!localhost) { // Production return "https://[your-better-auth-backend-url]"; } // Development return `http://${localhost}:8081`; // this should be the port of your Better Auth backend }; ``` --- <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-03-13 11:44:20 -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#4398