Furkan Özay
Furkan Özay
Explore posts from servers
BABetter Auth
Created by Furkan Özay on 4/12/2025 in #help
Redirect Problem
@bekacru can you help me ?
8 replies
BABetter Auth
Created by Furkan Özay on 4/12/2025 in #help
Redirect Problem
but now if the user is deleted, it is considered logged in because the cookie remains. Is there a clear solution to this problem? @Ping @bekacru
8 replies
BABetter Auth
Created by Furkan Özay on 4/12/2025 in #help
Redirect Problem
I fixed it with getSessionCookie, I'll leave it in case anyone else is experiencing this error
import { NextRequest, NextResponse } from "next/server";
import { getSessionCookie } from "better-auth/cookies";
const guestPaths = [
// your guestPaths...
];
const protectedPaths = [
// your protected paths...
];
export async function middleware(request: NextRequest) {
const session = getSessionCookie(request);
const { nextUrl } = request;
const { pathname } = nextUrl;
if (session && guestPaths.includes(pathname)) {
return NextResponse.redirect(new URL("/", request.url));
}
if (!session && protectedPaths.some((path) => pathname.startsWith(path))) {
return NextResponse.redirect(
new URL(`/auth/login?next=${pathname}`, request.url)
);
}
return NextResponse.next();
}

export const config = {
matcher: [
"/((?!api|_next/static|_next/image|favicon.ico|sitemap.xml|robots.txt).*)",
],
};
import { NextRequest, NextResponse } from "next/server";
import { getSessionCookie } from "better-auth/cookies";
const guestPaths = [
// your guestPaths...
];
const protectedPaths = [
// your protected paths...
];
export async function middleware(request: NextRequest) {
const session = getSessionCookie(request);
const { nextUrl } = request;
const { pathname } = nextUrl;
if (session && guestPaths.includes(pathname)) {
return NextResponse.redirect(new URL("/", request.url));
}
if (!session && protectedPaths.some((path) => pathname.startsWith(path))) {
return NextResponse.redirect(
new URL(`/auth/login?next=${pathname}`, request.url)
);
}
return NextResponse.next();
}

export const config = {
matcher: [
"/((?!api|_next/static|_next/image|favicon.ico|sitemap.xml|robots.txt).*)",
],
};
8 replies
BABetter Auth
Created by Furkan Özay on 3/21/2025 in #help
Kinde to Better-Auth
Yes, the problem was exactly due to my usage, when I set it with parseInt, everything was fixed, thank you very much, thank you very much. @Ping
85 replies
BABetter Auth
Created by Furkan Özay on 3/21/2025 in #help
Kinde to Better-Auth
No description
85 replies
BABetter Auth
Created by Furkan Özay on 3/21/2025 in #help
Kinde to Better-Auth
I can test other things if you want, user registration, login, etc.
85 replies
BABetter Auth
Created by Furkan Özay on 3/21/2025 in #help
Kinde to Better-Auth
GET /api/auth/get-session - 500
85 replies
BABetter Auth
Created by Furkan Özay on 3/21/2025 in #help
Kinde to Better-Auth
auth.api.getSession
85 replies
BABetter Auth
Created by Furkan Özay on 3/21/2025 in #help
Kinde to Better-Auth
getSession @Ping
85 replies
BABetter Auth
Created by Furkan Özay on 3/21/2025 in #help
Kinde to Better-Auth
1.2.6-beta.11 Prisma Adapter
85 replies
BABetter Auth
Created by Furkan Özay on 3/21/2025 in #help
Kinde to Better-Auth
No description
85 replies
BABetter Auth
Created by Furkan Özay on 3/21/2025 in #help
Kinde to Better-Auth
No description
85 replies
BABetter Auth
Created by Furkan Özay on 3/21/2025 in #help
Kinde to Better-Auth
how can I install this version with npm @Ping
85 replies
BABetter Auth
Created by Furkan Özay on 3/21/2025 in #help
Kinde to Better-Auth
oh, thank you for the information 🙏
85 replies
BABetter Auth
Created by Furkan Özay on 3/21/2025 in #help
Kinde to Better-Auth
I apologize for the spelling mistakes, my English is a bit weak
85 replies
BABetter Auth
Created by Furkan Özay on 3/21/2025 in #help
Kinde to Better-Auth
No description
85 replies
BABetter Auth
Created by Furkan Özay on 3/21/2025 in #help
Kinde to Better-Auth
I need to go out in production environment will it take much longer? @Ping @bekacru
85 replies
BABetter Auth
Created by Furkan Özay on 3/23/2025 in #help
onApiError custom error page
No, no matter what I did, I couldn't get it to work. @SxYxuse
31 replies
BABetter Auth
Created by Furkan Özay on 3/23/2025 in #help
onApiError custom error page
@bekacru Does this cause any problems?
31 replies
BABetter Auth
Created by Furkan Özay on 3/23/2025 in #help
onApiError custom error page
No description
31 replies