base path not resolving correctly

My server is running on port 8080 and client on 5173, I have created server auth instance by providing it basePath as "/auth" and created a route "/auth/*". For authClient instance i have provide full baseUrl as http://localhost:8080/auth. When i signin with google it sets the cookie but redirects to localhost:8080/auth. what is wrong here?
Solution:
I'm using express, and my baseURL in createAuthClient was 'http://localhost:3000' without a '/auth' in front of it. Another issue you might have is that you have to set the callback URL to a full URL. i.e. ``` const { error } = await authClient.signIn.social( {...
Jump to solution
2 Replies
Solution
Arnav
Arnav4d ago
I'm using express, and my baseURL in createAuthClient was 'http://localhost:3000' without a '/auth' in front of it. Another issue you might have is that you have to set the callback URL to a full URL. i.e.
const { error } = await authClient.signIn.social(
{
provider: 'google',
callbackURL: 'http://localhost:5173/home',
newUserCallbackURL: 'http://localhost:5173/home',
},
{
onError: (error) => {
console.error(error);
},
},
);
const { error } = await authClient.signIn.social(
{
provider: 'google',
callbackURL: 'http://localhost:5173/home',
newUserCallbackURL: 'http://localhost:5173/home',
},
{
onError: (error) => {
console.error(error);
},
},
);
instead of just
callbackURL: '/home'
callbackURL: '/home'
Not sure if this is helpful, but I had a similar issue and that's what worked for me.
APPLE
APPLEOP4d ago
thanks putting callbackUrl fixed it!

Did you find this page helpful?