Different frontend and backend URL with social logins

Hi, my backend is hosted on api.mydomain.com while my frontend is hosted on mydomain.com. Everytime I try to login through google social sign-in I get redirected to api.mydomain.com instead. How can I make better-auth work in this scenario?
Solution:
I just had to provide a callbackURL during signIn.social
Jump to solution
2 Replies
Solution
ChadGPT
ChadGPT4w ago
I just had to provide a callbackURL during signIn.social
ChadGPT
ChadGPTOP4w ago
e.g.
const handleGoogleLogin = useCallback(async () => {
await signIn.social({
provider: 'google',
callbackURL: `${config.baseUrl}${redirectPath}`,
});
}, [redirectPath]);
const handleGoogleLogin = useCallback(async () => {
await signIn.social({
provider: 'google',
callbackURL: `${config.baseUrl}${redirectPath}`,
});
}, [redirectPath]);

Did you find this page helpful?