docs(client): simplify disableDefaultFetchPlugins documentation

Co-authored-by: Taesu <bytaesu@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-02-05 20:29:18 +00:00
parent faae72f661
commit 82a44e70ba

View File

@@ -217,9 +217,7 @@ const authClient = createAuthClient({
### Disabling Default Fetch Plugins
By default, the auth client includes a redirect plugin that automatically handles browser redirects (e.g., after social sign-in) by setting `window.location.href`. This works well for browser-based applications but can cause issues in non-browser environments.
You can disable the default fetch plugins by setting `disableDefaultFetchPlugins` to `true`:
The auth client includes default fetch plugins that handle browser-specific behaviors like automatic redirects. For non-browser environments (e.g., React Native/Expo), you can disable these by setting `disableDefaultFetchPlugins` to `true`:
```ts title="auth-client.ts"
import { createAuthClient } from "better-auth/client"
@@ -227,17 +225,7 @@ import { createAuthClient } from "better-auth/client"
const authClient = createAuthClient({
disableDefaultFetchPlugins: true,
})
```
This is particularly useful for:
- **React Native / Expo apps**: These environments don't have `window.location`, so automatic redirects won't work. Use this option alongside platform-specific plugins like `expoClient` that handle navigation appropriately.
- **Custom redirect handling**: If you want full control over how redirects are processed (e.g., using a router's navigation methods instead of `window.location`).
- **Server-side rendering**: When you need to handle redirects differently on the server.
<Callout type="info">
When disabling default fetch plugins, make sure you have appropriate handling for redirects if your authentication flow requires them (e.g., OAuth/social login).
</Callout>
```
You can also pass fetch options to most of the client functions. Either as the second argument or as a property in the object.