mirror of
https://github.com/better-auth/better-auth.git
synced 2026-06-02 04:16:38 -05:00
fix(anonymous): filter specefic endpoints for linking
This commit is contained in:
@@ -161,7 +161,14 @@ export const anonymous = (options?: AnonymousOptions) => {
|
||||
const hasSessionToken = setCookie?.includes(
|
||||
context.context.authCookies.sessionToken.name,
|
||||
);
|
||||
return !!hasSessionToken;
|
||||
return (
|
||||
!!hasSessionToken &&
|
||||
(context.path.startsWith("/sign-in") ||
|
||||
context.path.startsWith("/callback") ||
|
||||
context.path.startsWith("/oauth2/callback") ||
|
||||
context.path.startsWith("/magic-link/verify") ||
|
||||
context.path.startsWith("/email-otp/verify-email"))
|
||||
);
|
||||
},
|
||||
handler: createAuthMiddleware(async (ctx) => {
|
||||
const headers = ctx.responseHeader;
|
||||
|
||||
Reference in New Issue
Block a user