obtaining the accountId which the user linked
Hello,
I'd like to add some functionality into my app which when a user links a new social account they will get redirected to
/dashboard/feed/{newAccountId}. However, it doesn't seem possible that the account ID is able to be retrieved, I tried using the onSuccess callback, but the response data includes no information about the social that they just linked. Is there a work around for this?
6 Replies
doing some sort of accounts fetch, sorting by newest first wouldn't really solve the problem because id have to assume that the linkSocial flow was successful, is there a way to check for errors? is this even a nice way of doing it?
You could try an after hook
https://www.better-auth.com/docs/concepts/hooks
Maybe the ctx will have the information and you can redirect users there
Hooks | Better Auth
Better Auth Hooks let you customize BetterAuth's behavior
Oh wait, there is a
callbackUrl, use this firsthi, thanks for the response. I am currrently using the callback url, but the issue is there is no way to obtain the new account information. I will take a look into the hooks though, thanks
Yes, make your callback url "normal" then hook it, so maybe you can get the data this way, then redirect if you must
This is what I meant
thank you for the reply lighttab, but unfortunately i was not able to figure this out, it doesnt look like the information is provided in the hook context.