getCookie() does not exist on authClient - Expo plugin errors

getCookie() does not exist on authClient and I'm getting errors from the expoClient plugin. I tried different versions but no luck.. Anyone experiencing similar or is it my fault? import { config } from "@/config"; import { expoClient } from "@better-auth/expo/client"; import { organizationClient } from "better-auth/client/plugins"; import { createAuthClient } from "better-auth/react"; import Constants from "expo-constants"; import * as SecureStore from "expo-secure-store"; const scheme = Constants.expoConfig?.scheme; if (typeof scheme !== "string") { throw new Error("Expo scheme is not set"); } const authClient = createAuthClient({ baseURL: config.serverBaseUrl, plugins: [ expoClient({ scheme, storage: SecureStore, }), organizationClient(), ], }); export { authClient }; --- Property 'getCookie' does not exist on type '{ signIn: { social: <FetchOptions extends { method?: string | undefined; cache?: RequestCache | undefined; credentials?: RequestCredentials | undefined; headers?: (HeadersInit & (HeadersInit | CommonHeaders)) | undefined; ... 30 more ...; disableValidation?: boolean | undefined; }>(data_0: Prettify<...>, data1?: Fe...'. --- Type '{ id: "expo"; getActions(: BetterFetch, $store: Store): { getCookie: () => string; useSession: () => any; }; fetchPlugins: { id: string; name: string; hooks: { onSuccess(context: SuccessContext<...>): Promise<...>; }; init(url: string, options: { ...; } | undefined): Promise<...>; }[]; }' is not assignable to type 'BetterAuthClientPlugin'. Types of property 'fetchPlugins' are incompatible.
16 Replies
bekacru
bekacru3mo ago
is it a type error or it doesn't work at all? also be on latest
luksch42
luksch42OP3mo ago
Doesn’t work at all. @bekacru
bekacru
bekacru3mo ago
just tried it on my end and it's working. try to remove org client if that's incase causing the bug. also make sure you're ong 1.1.8 or 1.1.9-beta.1
luksch42
luksch42OP2mo ago
Thanks for your help, I’ll figure that out tomorrow! Update: I cleared all types of caches and removed all node_modules folders in my repo, and now it's working again. 🙃
Bart ⚡
Bart ⚡2mo ago
Hey @luksch42 how did you fix the error? What versions are you using?
luksch42
luksch42OP2mo ago
@Bart ⚡ yes, I’m using a turbo repo and I guess somewhere was still an old better-auth version left which caused the error. Currently I’m on 1.1.8
Bart ⚡
Bart ⚡2mo ago
For both the plugin and the core library, right? I'm getting also error that getCookie does not exist on the client 😕 @luksch42
luksch42
luksch42OP2mo ago
Yes, for both. Is your client config ok? I had to set the storage explicitly after upgrading which was not the case before @Bart ⚡
Bart ⚡
Bart ⚡2mo ago
import { createAuthClient } from "better-auth/react";
import { expoClient } from "@better-auth/expo/client";

export const authClient = createAuthClient({
baseURL: getBaseUrl(),
plugins: [
expoClient({
storage: SecureStore,
}),
],
});
import { createAuthClient } from "better-auth/react";
import { expoClient } from "@better-auth/expo/client";

export const authClient = createAuthClient({
baseURL: getBaseUrl(),
plugins: [
expoClient({
storage: SecureStore,
}),
],
});
I'm doing it like this https://discord.com/channels/1288403910284935179/1315289116128313374/threads/1324794433924890714
luksch42
luksch42OP2mo ago
Let’s hop over to your issue 🙂
Bart ⚡
Bart ⚡2mo ago
Hey, @luksch42 which auth providers do you have in your Expo? Are they working good?
luksch42
luksch42OP2mo ago
Apple and google, working good @Bart ⚡
Bart ⚡
Bart ⚡2mo ago
is callbackUrl working for you? because for me it not redirects to the given path at the end of the request
luksch42
luksch42OP2mo ago
I‘ve read the past release notes this morning and there we‘re some expo related changes after 1.1. Maybe something related?
Bart ⚡
Bart ⚡2mo ago
I'm on v1.1.10 it's the newest version, but is it working for your implementation? I'm receiving session and I'm logged in, but I'm not redirected
Unknown User
Unknown User3w ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?