mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-07 04:19:22 +00:00
chore: remove api base url log from client
This commit is contained in:
2
demo/nextjs/.gitignore
vendored
2
demo/nextjs/.gitignore
vendored
@@ -38,3 +38,5 @@ yarn-error.log*
|
|||||||
# typescript
|
# typescript
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
next-env.d.ts
|
next-env.d.ts
|
||||||
|
|
||||||
|
certificates
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
|
"dev:secure": "next dev --experimental-https",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "next lint"
|
"lint": "next lint"
|
||||||
|
|||||||
@@ -34,11 +34,6 @@ export const csrfPlugin = {
|
|||||||
id: "csrf",
|
id: "csrf",
|
||||||
name: "CSRF Check",
|
name: "CSRF Check",
|
||||||
async init(url, options) {
|
async init(url, options) {
|
||||||
if (!options?.baseURL) {
|
|
||||||
throw new BetterAuthError(
|
|
||||||
"API Base URL on the auth client isn't configured. Please pass it directly to the client `baseURL`",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (options?.method !== "GET") {
|
if (options?.method !== "GET") {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
const { data, error } = await betterFetch<{
|
const { data, error } = await betterFetch<{
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export function getCookies(options: BetterAuthOptions) {
|
|||||||
const cookiePrefix = "better-auth";
|
const cookiePrefix = "better-auth";
|
||||||
const sessionMaxAge = new TimeSpan(7, "d").seconds();
|
const sessionMaxAge = new TimeSpan(7, "d").seconds();
|
||||||
const crossSubdomainEnabled =
|
const crossSubdomainEnabled =
|
||||||
options.advanced?.crossSubDomainCookies?.enabled;
|
!!options.advanced?.crossSubDomainCookies?.enabled;
|
||||||
|
|
||||||
const domain = crossSubdomainEnabled
|
const domain = crossSubdomainEnabled
|
||||||
? options.advanced?.crossSubDomainCookies?.domain ||
|
? options.advanced?.crossSubDomainCookies?.domain ||
|
||||||
@@ -37,7 +37,7 @@ export function getCookies(options: BetterAuthOptions) {
|
|||||||
path: "/",
|
path: "/",
|
||||||
secure: !!secureCookiePrefix,
|
secure: !!secureCookiePrefix,
|
||||||
maxAge: sessionMaxAge,
|
maxAge: sessionMaxAge,
|
||||||
...(crossSubdomainEnabled && { domain }),
|
...(crossSubdomainEnabled ? { domain } : {}),
|
||||||
} satisfies CookieOptions,
|
} satisfies CookieOptions,
|
||||||
},
|
},
|
||||||
csrfToken: {
|
csrfToken: {
|
||||||
@@ -48,7 +48,7 @@ export function getCookies(options: BetterAuthOptions) {
|
|||||||
path: "/",
|
path: "/",
|
||||||
secure: !!secureCookiePrefix,
|
secure: !!secureCookiePrefix,
|
||||||
maxAge: 60 * 60 * 24 * 7,
|
maxAge: 60 * 60 * 24 * 7,
|
||||||
...(crossSubdomainEnabled && { domain }),
|
...(crossSubdomainEnabled ? { domain } : {}),
|
||||||
} satisfies CookieOptions,
|
} satisfies CookieOptions,
|
||||||
},
|
},
|
||||||
state: {
|
state: {
|
||||||
@@ -58,8 +58,8 @@ export function getCookies(options: BetterAuthOptions) {
|
|||||||
sameSite,
|
sameSite,
|
||||||
path: "/",
|
path: "/",
|
||||||
secure: !!secureCookiePrefix,
|
secure: !!secureCookiePrefix,
|
||||||
maxAge: 60 * 15, // 15 minutes in seconds
|
maxAge: 60 * 15,
|
||||||
...(crossSubdomainEnabled && { domain }),
|
...(crossSubdomainEnabled ? { domain } : {}),
|
||||||
} satisfies CookieOptions,
|
} satisfies CookieOptions,
|
||||||
},
|
},
|
||||||
pkCodeVerifier: {
|
pkCodeVerifier: {
|
||||||
@@ -69,8 +69,8 @@ export function getCookies(options: BetterAuthOptions) {
|
|||||||
sameSite,
|
sameSite,
|
||||||
path: "/",
|
path: "/",
|
||||||
secure: !!secureCookiePrefix,
|
secure: !!secureCookiePrefix,
|
||||||
maxAge: 60 * 15, // 15 minutes in seconds
|
maxAge: 60 * 15,
|
||||||
...(crossSubdomainEnabled && { domain }),
|
...(crossSubdomainEnabled ? { domain } : {}),
|
||||||
} as CookieOptions,
|
} as CookieOptions,
|
||||||
},
|
},
|
||||||
dontRememberToken: {
|
dontRememberToken: {
|
||||||
@@ -81,7 +81,7 @@ export function getCookies(options: BetterAuthOptions) {
|
|||||||
path: "/",
|
path: "/",
|
||||||
secure: !!secureCookiePrefix,
|
secure: !!secureCookiePrefix,
|
||||||
//no max age so it expires when the browser closes
|
//no max age so it expires when the browser closes
|
||||||
...(crossSubdomainEnabled && { domain }),
|
...(crossSubdomainEnabled ? { domain } : {}),
|
||||||
} as CookieOptions,
|
} as CookieOptions,
|
||||||
},
|
},
|
||||||
nonce: {
|
nonce: {
|
||||||
@@ -91,8 +91,8 @@ export function getCookies(options: BetterAuthOptions) {
|
|||||||
sameSite,
|
sameSite,
|
||||||
path: "/",
|
path: "/",
|
||||||
secure: !!secureCookiePrefix,
|
secure: !!secureCookiePrefix,
|
||||||
maxAge: 60 * 15, // 15 minutes in seconds
|
maxAge: 60 * 15,
|
||||||
...(crossSubdomainEnabled && { domain }),
|
...(crossSubdomainEnabled ? { domain } : {}),
|
||||||
} as CookieOptions,
|
} as CookieOptions,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -127,7 +127,7 @@ export function createCookieGetter(options: BetterAuthOptions) {
|
|||||||
path: "/",
|
path: "/",
|
||||||
maxAge: 60 * 15, // 15 minutes in seconds
|
maxAge: 60 * 15, // 15 minutes in seconds
|
||||||
...opts,
|
...opts,
|
||||||
...(crossSubdomainEnabled && { domain }),
|
...(crossSubdomainEnabled ? { domain } : {}),
|
||||||
} as CookieOptions,
|
} as CookieOptions,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user