URL issues in social auth between Expo Frontend and Elysia Backend

Hey everyone! Setting up better-auth for an app, and there's an issue I'm facing.

On web, while running expo, after trying social login using github, I get redirected to my backend rather than the frontend.

I've setup the frontend (on port 8081) like this:
export const auth = createAuthClient({
    baseURL: API_URL, // backend api url (on port 3000)
    // could potentially change above to frontend url, but that's not where the auth server is, since I'm connected to an elysia backend
    plugins: [
        expoClient({
            scheme: "myapp",
            storagePrefix: "myapp",
            storage: SecureStore,
        }),
    ],
});

// ....

export async function signInSocial() {
    await auth.signIn.social({
        provider: "github",
        callbackURL: "/test", // redirects to API_URL/test on web (docs say it changes to app url when running in native)
    });
}


I believe the issue would be around here, but I can show the backend configuration as well if that's needed.
Thank you for your help.
Was this page helpful?