mirror of
https://github.com/better-auth/better-auth.git
synced 2026-08-01 10:50:40 -05:00
fix: remove deep array merge when merging hooks context (#3160)
* Update to-auth-endpoints.ts fixed * biome error * first commit * fix(org): use correct slug lookup when setting active org * docs: adding reference to surrealdb adapter rewrite (#3754) Adding reference to surrealdb adapter rewrite, with passing tests and schema generation as well as surreal native parameters. * chore(demo): replace isLoading using `useTransition` (#3775) * fix: use `useTransition` for isLoading * fixup! fix: use `useTransition` for isLoading * fix(reddit): refresh access token should use `basic` auth (#3753) * reddit auth type * changesets * chore: remove changeset --------- Co-authored-by: Bereket Engida <86073083+Bekacru@users.noreply.github.com> * docs: unify component implementations for consistency (#3799) * fix(docs): unify component implementations for consistency * update * fix: add missing team reference in teamMember schema (#3801) * fix(organization): team members should be cleaned up on delete team (#3833) * feat(stripe): create billing portal session (#3625) * feat(stripe) : add billing portal session endpoint * create billing portal session * update docs * chore: changeset * chore: fix stripe * chore: remove comment * chore: update docs --------- Co-authored-by: Bereket Engida <Bekacru@gmail.com> Co-authored-by: Bereket Engida <86073083+Bekacru@users.noreply.github.com> * fix(cli): prisma schema generate mismatch on custom plugin table names (#3021) * fix: generate mismatch * clean up * linkt * lint * clean up * clean up * lint * lint * test * clean up * clean up * lint * update * docs: update TOTP 2FA docs to state that Better-Auth implements a delay window (#3586) Better Auth uses a delay window for TOTP code verification to ensure that it is resilient to time delays * docs: remove unused import of 'auth' type in authClient setup (#3856) In the previous implementation, the import statement for 'auth' type from './auth' was included as part of the setup for the authClient, but it is no longer being used in the current code. This update removes the unnecessary import to clean up the code and prevent potential confusion. Additionally, the authClient setup remains intact with the use of 'inferAdditionalFields' plugin to define additional user fields (role type set to 'string'). - Removed unused import: `import type { auth } from "./auth"` - Kept the authClient initialization with 'inferAdditionalFields' plugin This resolves a minor issue and ensures that the code remains clean and maintainable. * docs: enhance trustedOrigins option with examples (#3857) * docs: enhance trustedOrigins option documentation * nit * docs: fix typo in SSR performance section The line was missing "the". Co-authored-by: KinfeMichael Tariku <65047246+Kinfe123@users.noreply.github.com> * chore: update api key docs (#3864) Closes #3724 * docs: fix google auth prompt (#3894) Google OAuth2 uses space delimiters instead of + https://developers.google.com/identity/protocols/oauth2/web-server * docs(hono): update RPC client to use init config instead of custom fetch (#3597) * add test * chore: lint --------- Co-authored-by: KinfeMichael Tariku <65047246+Kinfe123@users.noreply.github.com> Co-authored-by: Manuel Sanchez <manuel@msanchez.dev> Co-authored-by: Alex Yang <himself65@outlook.com> Co-authored-by: Bereket Engida <86073083+Bekacru@users.noreply.github.com> Co-authored-by: dogus <147812199+rhitune2@users.noreply.github.com> Co-authored-by: Bereket Engida <Bekacru@gmail.com> Co-authored-by: Hysterelius <71912794+Hysterelius@users.noreply.github.com> Co-authored-by: Jovan Lanutan <jolanutan@gmail.com> Co-authored-by: Nate <37544626+ntedvs@users.noreply.github.com> Co-authored-by: Dagmawi Babi <44819176+dagmawibabi@users.noreply.github.com> Co-authored-by: Braden Wong <13159333+braden-w@users.noreply.github.com>
This commit is contained in:
committed by
Bereket Engida
co-authored by
KinfeMichael Tariku
Manuel Sanchez
Alex Yang
Bereket Engida
dogus
Bereket Engida
Hysterelius
Jovan Lanutan
Nate
Dagmawi Babi
Braden Wong
parent
fa4c6fb3e4
commit
cf65b2cb60
@@ -10,13 +10,13 @@ export const auth = betterAuth({
|
||||
socialProviders: {
|
||||
discord: {
|
||||
enabled: true,
|
||||
clientId: process.env.DISCORD_CLIENT_ID!,
|
||||
clientSecret: process.env.DISCORD_CLIENT_SECRET!,
|
||||
clientId: process.env.DISCORD_CLIENT_ID as string,
|
||||
clientSecret: process.env.DISCORD_CLIENT_SECRET as string,
|
||||
},
|
||||
github: {
|
||||
enabled: true,
|
||||
clientId: process.env.GITHUB_CLIENT_ID!,
|
||||
clientSecret: process.env.GITHUB_CLIENT_SECRET!,
|
||||
clientId: process.env.GITHUB_CLIENT_ID as string,
|
||||
clientSecret: process.env.GITHUB_CLIENT_SECRET as string,
|
||||
},
|
||||
},
|
||||
plugins: [twoFactor()],
|
||||
|
||||
@@ -76,229 +76,227 @@ function RootComponent() {
|
||||
|
||||
return (
|
||||
<RootDocument>
|
||||
<>
|
||||
<nav className="grid grid-cols-3 items-center w-full p-4">
|
||||
<div className="flex items-center justify-center gap-2">
|
||||
<svg
|
||||
width="60"
|
||||
height="45"
|
||||
viewBox="0 0 60 45"
|
||||
fill="none"
|
||||
className="w-5 h-5"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
<nav className="grid grid-cols-3 items-center w-full p-4">
|
||||
<div className="flex items-center justify-center gap-2">
|
||||
<svg
|
||||
width="60"
|
||||
height="45"
|
||||
viewBox="0 0 60 45"
|
||||
fill="none"
|
||||
className="w-5 h-5"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<title>Better Auth</title>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M0 0H15V15H30V30H15V45H0V30V15V0ZM45 30V15H30V0H45H60V15V30V45H45H30V30H45Z"
|
||||
className="fill-black dark:fill-white"
|
||||
/>
|
||||
</svg>
|
||||
<p>BETTER-AUTH</p>
|
||||
<p>x</p>
|
||||
<svg
|
||||
className="w-5 h-5"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="45"
|
||||
height="45"
|
||||
viewBox="0 0 100 100"
|
||||
fill="none"
|
||||
>
|
||||
<title>TanStack Start</title>
|
||||
<mask
|
||||
id="a"
|
||||
style={{ maskType: "alpha" }}
|
||||
maskUnits="userSpaceOnUse"
|
||||
x="0"
|
||||
y="0"
|
||||
width="100"
|
||||
height="100"
|
||||
>
|
||||
<title>Better Auth</title>
|
||||
<circle cx="50" cy="50" r="50" className="fill-foreground" />
|
||||
</mask>
|
||||
<g mask="url(#a)">
|
||||
<circle
|
||||
cx="11"
|
||||
cy="119"
|
||||
r="52"
|
||||
className="fill-muted-foreground stroke-foreground"
|
||||
strokeWidth="4"
|
||||
/>
|
||||
<circle
|
||||
cx="10"
|
||||
cy="125"
|
||||
r="52"
|
||||
className="fill-muted-foreground stroke-foreground"
|
||||
strokeWidth="4"
|
||||
/>
|
||||
<circle
|
||||
cx="9"
|
||||
cy="131"
|
||||
r="52"
|
||||
className="fill-muted-foreground stroke-muted-foreground"
|
||||
strokeWidth="4"
|
||||
/>
|
||||
<circle
|
||||
cx="88"
|
||||
cy="119"
|
||||
r="52"
|
||||
className="fill-muted-foreground stroke-foreground"
|
||||
strokeWidth="4"
|
||||
/>
|
||||
<path
|
||||
className="fill-foreground"
|
||||
d="M89 35h2v5h-2zM83 34l2 1-1 4h-2zM77 31l2 1-3 4-2-1zM73 27l1 1-3 4-1-2zM70 23l1 1-4 3-1-2zM68 18v2l-4 1-1-2zM68 11l1 2-5 1-1-2zM69 6v2h-5V6z"
|
||||
/>
|
||||
<circle
|
||||
cx="89"
|
||||
cy="125"
|
||||
r="52"
|
||||
className="fill-muted-foreground stroke-foreground"
|
||||
strokeWidth="4"
|
||||
/>
|
||||
<circle
|
||||
cx="90"
|
||||
cy="131"
|
||||
r="52"
|
||||
className="fill-muted-foreground stroke-muted-foreground"
|
||||
strokeWidth="4"
|
||||
/>
|
||||
<ellipse
|
||||
cx="49.5"
|
||||
cy="119"
|
||||
rx="41.5"
|
||||
ry="51"
|
||||
className="fill-muted-foreground"
|
||||
/>
|
||||
<path
|
||||
d="M34 38v-9c1 1 2 4 5 6l7 30-8 2c-1-23-2-23-4-29Z"
|
||||
className="fill-foreground stroke-muted-foreground"
|
||||
/>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M0 0H15V15H30V30H15V45H0V30V15V0ZM45 30V15H30V0H45H60V15V30V45H45H30V30H45Z"
|
||||
className="fill-black dark:fill-white"
|
||||
d="M95 123c0 31-20 57-45 57S5 154 5 123c0-27 14-50 33-56l12-2c25 0 45 26 45 58Zm-45 47c22 0 39-22 39-50S72 70 50 70s-39 22-39 50 17 50 39 50Z"
|
||||
className="fill-foreground"
|
||||
/>
|
||||
</svg>
|
||||
<p>BETTER-AUTH</p>
|
||||
<p>x</p>
|
||||
<svg
|
||||
className="w-5 h-5"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="45"
|
||||
height="45"
|
||||
viewBox="0 0 100 100"
|
||||
fill="none"
|
||||
>
|
||||
<title>TanStack Start</title>
|
||||
<mask
|
||||
id="a"
|
||||
style={{ maskType: "alpha" }}
|
||||
maskUnits="userSpaceOnUse"
|
||||
x="0"
|
||||
y="0"
|
||||
width="100"
|
||||
height="100"
|
||||
>
|
||||
<circle cx="50" cy="50" r="50" className="fill-foreground" />
|
||||
</mask>
|
||||
<g mask="url(#a)">
|
||||
<circle
|
||||
cx="11"
|
||||
cy="119"
|
||||
r="52"
|
||||
className="fill-muted-foreground stroke-foreground"
|
||||
strokeWidth="4"
|
||||
/>
|
||||
<circle
|
||||
cx="10"
|
||||
cy="125"
|
||||
r="52"
|
||||
className="fill-muted-foreground stroke-foreground"
|
||||
strokeWidth="4"
|
||||
/>
|
||||
<circle
|
||||
cx="9"
|
||||
cy="131"
|
||||
r="52"
|
||||
className="fill-muted-foreground stroke-muted-foreground"
|
||||
strokeWidth="4"
|
||||
/>
|
||||
<circle
|
||||
cx="88"
|
||||
cy="119"
|
||||
r="52"
|
||||
className="fill-muted-foreground stroke-foreground"
|
||||
strokeWidth="4"
|
||||
/>
|
||||
<path
|
||||
className="fill-foreground"
|
||||
d="M89 35h2v5h-2zM83 34l2 1-1 4h-2zM77 31l2 1-3 4-2-1zM73 27l1 1-3 4-1-2zM70 23l1 1-4 3-1-2zM68 18v2l-4 1-1-2zM68 11l1 2-5 1-1-2zM69 6v2h-5V6z"
|
||||
/>
|
||||
<circle
|
||||
cx="89"
|
||||
cy="125"
|
||||
r="52"
|
||||
className="fill-muted-foreground stroke-foreground"
|
||||
strokeWidth="4"
|
||||
/>
|
||||
<circle
|
||||
cx="90"
|
||||
cy="131"
|
||||
r="52"
|
||||
className="fill-muted-foreground stroke-muted-foreground"
|
||||
strokeWidth="4"
|
||||
/>
|
||||
<ellipse
|
||||
cx="49.5"
|
||||
cy="119"
|
||||
rx="41.5"
|
||||
ry="51"
|
||||
className="fill-muted-foreground"
|
||||
/>
|
||||
<path
|
||||
d="M34 38v-9c1 1 2 4 5 6l7 30-8 2c-1-23-2-23-4-29Z"
|
||||
className="fill-foreground stroke-muted-foreground"
|
||||
/>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M95 123c0 31-20 57-45 57S5 154 5 123c0-27 14-50 33-56l12-2c25 0 45 26 45 58Zm-45 47c22 0 39-22 39-50S72 70 50 70s-39 22-39 50 17 50 39 50Z"
|
||||
className="fill-foreground"
|
||||
/>
|
||||
<path
|
||||
d="M34 29c-4-8-11-5-14-4 2 3 5 4 9 4h5Z"
|
||||
className="fill-foreground stroke-muted-foreground"
|
||||
/>
|
||||
<path
|
||||
d="M25 38c-1 6 0 14 2 18 5-7 7-13 7-18v-9c-5 1-7 5-9 9Z"
|
||||
className="fill-muted-foreground"
|
||||
/>
|
||||
<path
|
||||
d="M34 29c-1 3-5 11-5 16m5-16c-5 1-7 5-9 9-1 6 0 14 2 18 5-7 7-13 7-18v-9Z"
|
||||
className="stroke-muted-foreground"
|
||||
/>
|
||||
<path
|
||||
d="M44 18c-10 1-11 7-10 11l4-3c5-4 6-7 6-8Z"
|
||||
className="fill-foreground stroke-muted-foreground"
|
||||
/>
|
||||
<path
|
||||
d="M34 29h7l18 4c-3-6-9-14-21-7l-4 3Z"
|
||||
className="fill-foreground"
|
||||
/>
|
||||
<path
|
||||
d="M34 29c4-2 12-5 18-1m-18 1h7l18 4c-3-6-9-14-21-7l-4 3Z"
|
||||
className="stroke-muted-foreground"
|
||||
/>
|
||||
<path
|
||||
d="M32 29a1189 1189 0 0 1-16 19c0-17 7-18 13-19h5a14 14 0 0 1-2 0Z"
|
||||
className="fill-foreground"
|
||||
/>
|
||||
<path
|
||||
d="M34 29c-5 1-7 5-9 9l-9 10c0-17 7-18 13-19h5Zm0 0c-5 2-11 3-14 10"
|
||||
className="stroke-muted-foreground"
|
||||
/>
|
||||
<path
|
||||
d="M41 29c9 2 13 10 15 14a25 25 0 0 1-22-14h7Z"
|
||||
className="fill-foreground"
|
||||
/>
|
||||
<path
|
||||
d="M34 29c3 1 11 5 15 9m-15-9h7c9 2 13 10 15 14a25 25 0 0 1-22-14Z"
|
||||
className="stroke-muted-foreground"
|
||||
/>
|
||||
<circle
|
||||
cx="91.5"
|
||||
cy="12.5"
|
||||
r="18.5"
|
||||
className="fill-foreground stroke-muted-foreground"
|
||||
strokeWidth="2"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
<p>TANSTACK START.</p>
|
||||
</div>
|
||||
<div className="flex items-center justify-center gap-4">
|
||||
{data?.user ? (
|
||||
<p>Hello {data.user.name}</p>
|
||||
) : (
|
||||
<NavigationMenu>
|
||||
<NavigationMenuList>
|
||||
<NavigationMenuItem>
|
||||
<NavigationMenuLink asChild>
|
||||
<Link
|
||||
to="/auth/signin"
|
||||
className={navigationMenuTriggerStyle()}
|
||||
activeProps={{ className: "bg-accent/50" }}
|
||||
>
|
||||
Sign In
|
||||
</Link>
|
||||
</NavigationMenuLink>
|
||||
</NavigationMenuItem>
|
||||
<NavigationMenuItem>
|
||||
<NavigationMenuLink asChild>
|
||||
<Link
|
||||
to="/auth/signup"
|
||||
className={navigationMenuTriggerStyle()}
|
||||
activeProps={{ className: "bg-accent/50" }}
|
||||
>
|
||||
Sign Up
|
||||
</Link>
|
||||
</NavigationMenuLink>
|
||||
</NavigationMenuItem>
|
||||
</NavigationMenuList>
|
||||
</NavigationMenu>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex items-center gap-4 justify-center">
|
||||
{data?.user && (
|
||||
<Button
|
||||
onClick={() =>
|
||||
signOut(
|
||||
{},
|
||||
{
|
||||
onError: (error) => {
|
||||
console.warn(error);
|
||||
toast.error(error.error.message);
|
||||
},
|
||||
onSuccess: () => {
|
||||
toast.success("You have been signed out!");
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
variant="destructive"
|
||||
>
|
||||
<DoorOpen className="w-5 h-5" />
|
||||
</Button>
|
||||
)}
|
||||
<path
|
||||
d="M34 29c-4-8-11-5-14-4 2 3 5 4 9 4h5Z"
|
||||
className="fill-foreground stroke-muted-foreground"
|
||||
/>
|
||||
<path
|
||||
d="M25 38c-1 6 0 14 2 18 5-7 7-13 7-18v-9c-5 1-7 5-9 9Z"
|
||||
className="fill-muted-foreground"
|
||||
/>
|
||||
<path
|
||||
d="M34 29c-1 3-5 11-5 16m5-16c-5 1-7 5-9 9-1 6 0 14 2 18 5-7 7-13 7-18v-9Z"
|
||||
className="stroke-muted-foreground"
|
||||
/>
|
||||
<path
|
||||
d="M44 18c-10 1-11 7-10 11l4-3c5-4 6-7 6-8Z"
|
||||
className="fill-foreground stroke-muted-foreground"
|
||||
/>
|
||||
<path
|
||||
d="M34 29h7l18 4c-3-6-9-14-21-7l-4 3Z"
|
||||
className="fill-foreground"
|
||||
/>
|
||||
<path
|
||||
d="M34 29c4-2 12-5 18-1m-18 1h7l18 4c-3-6-9-14-21-7l-4 3Z"
|
||||
className="stroke-muted-foreground"
|
||||
/>
|
||||
<path
|
||||
d="M32 29a1189 1189 0 0 1-16 19c0-17 7-18 13-19h5a14 14 0 0 1-2 0Z"
|
||||
className="fill-foreground"
|
||||
/>
|
||||
<path
|
||||
d="M34 29c-5 1-7 5-9 9l-9 10c0-17 7-18 13-19h5Zm0 0c-5 2-11 3-14 10"
|
||||
className="stroke-muted-foreground"
|
||||
/>
|
||||
<path
|
||||
d="M41 29c9 2 13 10 15 14a25 25 0 0 1-22-14h7Z"
|
||||
className="fill-foreground"
|
||||
/>
|
||||
<path
|
||||
d="M34 29c3 1 11 5 15 9m-15-9h7c9 2 13 10 15 14a25 25 0 0 1-22-14Z"
|
||||
className="stroke-muted-foreground"
|
||||
/>
|
||||
<circle
|
||||
cx="91.5"
|
||||
cy="12.5"
|
||||
r="18.5"
|
||||
className="fill-foreground stroke-muted-foreground"
|
||||
strokeWidth="2"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
<p>TANSTACK START.</p>
|
||||
</div>
|
||||
<div className="flex items-center justify-center gap-4">
|
||||
{data?.user ? (
|
||||
<p>Hello {data.user.name}</p>
|
||||
) : (
|
||||
<NavigationMenu>
|
||||
<NavigationMenuList>
|
||||
<NavigationMenuItem>
|
||||
<NavigationMenuLink asChild>
|
||||
<Link
|
||||
to="/auth/signin"
|
||||
className={navigationMenuTriggerStyle()}
|
||||
activeProps={{ className: "bg-accent/50" }}
|
||||
>
|
||||
Sign In
|
||||
</Link>
|
||||
</NavigationMenuLink>
|
||||
</NavigationMenuItem>
|
||||
<NavigationMenuItem>
|
||||
<NavigationMenuLink asChild>
|
||||
<Link
|
||||
to="/auth/signup"
|
||||
className={navigationMenuTriggerStyle()}
|
||||
activeProps={{ className: "bg-accent/50" }}
|
||||
>
|
||||
Sign Up
|
||||
</Link>
|
||||
</NavigationMenuLink>
|
||||
</NavigationMenuItem>
|
||||
</NavigationMenuList>
|
||||
</NavigationMenu>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex items-center gap-4 justify-center">
|
||||
{data?.user && (
|
||||
<Button
|
||||
onClick={() => setTheme(theme === "light" ? "dark" : "light")}
|
||||
onClick={() =>
|
||||
signOut(
|
||||
{},
|
||||
{
|
||||
onError: (error) => {
|
||||
console.warn(error);
|
||||
toast.error(error.error.message);
|
||||
},
|
||||
onSuccess: () => {
|
||||
toast.success("You have been signed out!");
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
variant="destructive"
|
||||
>
|
||||
{theme === "light" ? (
|
||||
<Moon onClick={() => setTheme("dark")} className="w-5 h-5" />
|
||||
) : (
|
||||
<Sun onClick={() => setTheme("light")} className="w-5 h-5" />
|
||||
)}
|
||||
<DoorOpen className="w-5 h-5" />
|
||||
</Button>
|
||||
</div>
|
||||
</nav>
|
||||
<Outlet />
|
||||
</>
|
||||
)}
|
||||
<Button
|
||||
onClick={() => setTheme(theme === "light" ? "dark" : "light")}
|
||||
>
|
||||
{theme === "light" ? (
|
||||
<Moon onClick={() => setTheme("dark")} className="w-5 h-5" />
|
||||
) : (
|
||||
<Sun onClick={() => setTheme("light")} className="w-5 h-5" />
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
</nav>
|
||||
<Outlet />
|
||||
<Toaster richColors position="bottom-center" />
|
||||
</RootDocument>
|
||||
);
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
{
|
||||
"root": false,
|
||||
"$schema": "https://biomejs.dev/schemas/2.1.3/schema.json",
|
||||
"vcs": {
|
||||
"enabled": false,
|
||||
"clientKind": "git",
|
||||
"useIgnoreFile": false
|
||||
},
|
||||
"files": {
|
||||
"includes": [
|
||||
"**",
|
||||
"!**/dist",
|
||||
"!**/build",
|
||||
"!**/.next",
|
||||
"!**/.svelte-kit",
|
||||
"!**/package.json",
|
||||
"!**/.contentlayer",
|
||||
"!**/.turbo",
|
||||
"!**/.nuxt",
|
||||
"!**/.source",
|
||||
"!**/.expo",
|
||||
"!**/.cache",
|
||||
"!**/dev/cloudflare/drizzle"
|
||||
]
|
||||
},
|
||||
"formatter": {
|
||||
"enabled": true,
|
||||
"indentStyle": "tab"
|
||||
},
|
||||
"assist": { "actions": { "source": { "organizeImports": "on" } } },
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
"recommended": true
|
||||
}
|
||||
},
|
||||
"javascript": {
|
||||
"formatter": {
|
||||
"quoteStyle": "double"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user