User Cancelling Authentication Redirects to Better Auth Error Page

export const facebookSignIn = async () => {
const data = await authClient.signIn.social({
provider: "facebook",
callbackURL: "/profile",
errorCallbackURL: "/sign-in",
});

return data;
};
export const facebookSignIn = async () => {
const data = await authClient.signIn.social({
provider: "facebook",
callbackURL: "/profile",
errorCallbackURL: "/sign-in",
});

return data;
};
this is my code for facebook login, i have the errorCallbackURL to go to "/sign-in" but it doesn't fall back to this redirect instead it goes staright to the default better auth error page. my database is fully set up, the error in the url says:
http://localhost:3000/api/auth/error?error=access_denied&error_description=Permissions%20error#_=_
http://localhost:3000/api/auth/error?error=access_denied&error_description=Permissions%20error#_=_
Solution:
ended up fixing this by adding errorURL to my betterAuth for the onAPIError property ``` onAPIError: { throw: true, onError: (error, ctx) => { console.error("Auth error:", error);...
Jump to solution
5 Replies
KiNFiSH
KiNFiSH3w ago
Have you checked your logs like terminal logs
stevem
stevemOP3w ago
Yea everything looked fine
stevem
stevemOP3w ago
this is what i see in my logs
No description
KiNFiSH
KiNFiSH3w ago
is the error expected ? and you trynna check if it is redirected to the /sign-in
Solution
stevem
stevem3w ago
ended up fixing this by adding errorURL to my betterAuth for the onAPIError property
onAPIError: {
throw: true,
onError: (error, ctx) => {
console.error("Auth error:", error);
},
errorURL: "/sign-in",
},
onAPIError: {
throw: true,
onError: (error, ctx) => {
console.error("Auth error:", error);
},
errorURL: "/sign-in",
},

Did you find this page helpful?