UNPKG

better-auth

Version:

The most comprehensive authentication framework for TypeScript.

18 lines (17 loc) 491 B
import { isSafeUrlScheme } from "@better-auth/core/utils/url"; //#region src/client/fetch-plugins.ts const redirectPlugin = { id: "redirect", name: "Redirect", hooks: { onSuccess(context) { if (context.data?.url && context.data?.redirect && isSafeUrlScheme(context.data.url)) { if (typeof window !== "undefined" && window.location) { if (window.location) try { window.location.href = context.data.url; } catch {} } } } } }; //#endregion export { redirectPlugin };