luksch42
BABetter Auth
•Created by luksch42 on 3/5/2025 in #help
Sign in with Apple in web fails / error: 'invalid_client'
I'm facing issues with Sign in with Apple in my Better Auth setup:
Current Status
- ✅ Apple Sign In works in my Expo (native) app using ID token
- ❌ Apple Sign In fails on web
Configuration Details
- Using Better Auth with Expo plugin
- JWT payload for client secret looks correct:
- Web Service ID:
de.xxx.web
- App Bundle ID: de.xxx.app
Error Messages
Server logs show:
I've added https://appleid.apple.com
to trustedOrigins
as suggested (should not be needed?), but still experiencing web authentication issues. Any ideas what might be causing this discrepancy between native and web authentication?14 replies
BABetter Auth
•Created by luksch42 on 1/2/2025 in #help
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.31 replies
BABetter Auth
•Created by luksch42 on 12/12/2024 in #help
empty session in custom plugin hook
I wanna hook into the organization endpoints but the session property is null. I'm authenticated and the cookie is present in the request headers too. Am I missing something?
import type { BetterAuthPlugin } from "better-auth";
import { posthog } from "@.../posthog";
import { createAuthMiddleware } from "better-auth/plugins";
export const posthogPlugin = () =>
({
id: "posthogPlugin",
hooks: {
after: [
{
matcher: ({ path }) => {
if (path === "/organization/create") {
return true;
}
return false;
},
handler: createAuthMiddleware(async (ctx) => {
console.log("hello from handler");
console.log("ctx.context.session", ctx);
if (!ctx.context.session) {
return;
}
console.log("organization_create", ctx.context.session);
posthog.capture({
distinctId: ctx.context.session.user.id,
event: "organization_create",
});
}),
},
],
},
}) satisfies BetterAuthPlugin;
2 replies
BABetter Auth
•Created by luksch42 on 12/11/2024 in #help
Organizations database hooks
Im currently integrating PostHog and used the database hooks to track auth related events. Is there a way to hook into the organizations plugin?
7 replies
BABetter Auth
•Created by luksch42 on 10/22/2024 in #bug-reports
'import.meta' is currently unsupported, js engine: hermes [Component Stack]
…import {env as p} from “std-env”;
I’m getting this in an Expo/React Native project. The Metro Bundler has no import.meta support yet and it seems like this could take a while
5 replies
BABetter Auth
•Created by luksch42 on 10/19/2024 in #bug-reports
Google SSO not working
Social auth with google is currently not working for me.
In my production environment and same for demo.better-auth.com/sign-in
24 replies