How to change the redirect after linking a social provider?
I'm having a hard time figuring out how I can tell
better-auth to redirect to, let's say, /dashboard/connections/discord after a user links their Discord account to their main account via:
Currently, after linking a Discord account, better-auth redirects the user to the home page (/), which is weird and very bad UX, as the linking initiated on /dashboard/connections/discord, a user would assume that they get back to the same page after going through the linking process.
src/lib/server/auth.ts:
Solution:Jump to solution
You can pass in a callback url with the provider like
await authClient.linkSocial({
provider: "discord",
callbackURL: "/dashboard/connections/discord"...
2 Replies
Solution
You can pass in a callback url with the provider like
await authClient.linkSocial({
provider: "discord",
callbackURL: "/dashboard/connections/discord"
});
I thought the callback url was for the callback with the codes itself, hence the name? Not to change where the user ends up.
I’ll give that a go then, thanks!