After hook for social logins, newSession is null?

When I sign up with my social accounts, ctx.context.newSession is always null in the after hook. Is this intended? If so, how can I handle https://www.better-auth.com/docs/concepts/hooks#example-send-a-notification-to-your-channel-when-a-new-user-is-registered but for social? It works fine for e.g. email otp
Hooks | Better Auth
Better Auth Hooks let you customize BetterAuth's behavior
Solution:
newSession on social logins is generated on /callback path not on /sign-in/social
Jump to solution
4 Replies
Solution
bekacru
bekacru2mo ago
newSession on social logins is generated on /callback path not on /sign-in/social
Amos
AmosOP2mo ago
Is there a way to get the provider (e.g. google, facebook) in this hook?
bekacru
bekacru2mo ago
you can get it from the path. ctx.path will have /callback/:providerId
Amos
AmosOP2mo ago
I tried logging it before but it just shows '/callback/:id', so I guess you need to get it from somewhere else or am I just being stupid Params I guess, lemme check Yeah got it, thanks

Did you find this page helpful?