Expo Google sign in invalid callback URL: {"data": null, "error": {"code": "INVALID_CALLBACKURL", "m

I'm doing a React Native+Expo frontend and express backend mobile app. I want to add the google Oauth sign in. However it's not taking me to the google page for the sign in.

In this case, how to set up the better auth for expo?

Frontend:
// lib/auth-client.ts
import { expoClient } from "@better-auth/expo/client";
import { createAuthClient } from "better-auth/react";
import * as SecureStore from "expo-secure-store";

export const authClient = createAuthClient({
  baseURL: "http://localhost:3000",
  plugins: [
    expoClient({
      scheme: "miraphotofrontend",
      storagePrefix: "miraphotofrontend",
      storage: SecureStore,
    }),
  ],
});


const signInWithGoogle = async () => {
    try {
      console.log("Starting Google sign-in...");
      console.log("Auth client baseURL:", "http://localhost:3000");
      console.log("Scheme:", "miraphotofrontend");
      const data = await authClient.signIn.social({
        provider: "google",
        callbackURL: "/dashboard",
      });
      console.log("Google sign-in success:", data);
    } catch (error) {
      console.error("Google sign-in error:", error);
    }
  };
Was this page helpful?