Property 'signIn' does not exist

import { createAuthClient } from "better-auth/react";

export const { signOut, useSession, signIn } = createAuthClient({
baseURL: process.env.BETTER_AUTH_URL!,
});
import { createAuthClient } from "better-auth/react";

export const { signOut, useSession, signIn } = createAuthClient({
baseURL: process.env.BETTER_AUTH_URL!,
});
Property 'signIn' does not exist on type '{ signOut: <FetchOptions extends { method?: string | undefined; headers?: (HeadersInit & (HeadersInit | CommonHeaders)) | undefined; cache?: RequestCache | undefined; ... 35 more ...; disableValidation?: boolean | undefined; }>(data_0?: Prettify<...> | undefined, data_1?: FetchOptions | undefined) => Promise<...>; }...'.ts(2339)
Property 'signIn' does not exist on type '{ signOut: <FetchOptions extends { method?: string | undefined; headers?: (HeadersInit & (HeadersInit | CommonHeaders)) | undefined; cache?: RequestCache | undefined; ... 35 more ...; disableValidation?: boolean | undefined; }>(data_0?: Prettify<...> | undefined, data_1?: FetchOptions | undefined) => Promise<...>; }...'.ts(2339)
Solution:
first make sure to config your auth correctly and to do the recomend of destructing the object since i dont exactly know your rules config for that but i recomend this way and also the safest way ```ts const authClient = createAuthClient({ baseURL: process.env.BETTER_AUTH_URL!, });...
Jump to solution
2 Replies
Solution
KiNFiSH
KiNFiSH2w ago
first make sure to config your auth correctly and to do the recomend of destructing the object since i dont exactly know your rules config for that but i recomend this way and also the safest way
const authClient = createAuthClient({
baseURL: process.env.BETTER_AUTH_URL!,
});

export const {
signOut,
useSession,
signIn,

} = authClient;
const authClient = createAuthClient({
baseURL: process.env.BETTER_AUTH_URL!,
});

export const {
signOut,
useSession,
signIn,

} = authClient;
if this does not work, may be force infer the client like this
type BAClient = ReturnType<typeof createAuthClient>
export const authClient = createAuthClient({
baseURL: process.env.BETTER_AUTH_URL!,
fetchOptions: {
credentials: "include",
},
}) as BAClient;
type BAClient = ReturnType<typeof createAuthClient>
export const authClient = createAuthClient({
baseURL: process.env.BETTER_AUTH_URL!,
fetchOptions: {
credentials: "include",
},
}) as BAClient;
and try using singIn if thats work
PDDO
PDDOOP2w ago
thanks for your answer

Did you find this page helpful?