sebastian
sebastian
BABetter Auth
Created by Lionvsx on 5/21/2025 in #help
Sub domain auth
What went wrong ?
7 replies
BABetter Auth
Created by Shezan on 5/21/2025 in #help
rate limiting server actions
Rate limiting only works with authClient. On server, you would have to implement it yourself
3 replies
BABetter Auth
Created by Lionvsx on 5/21/2025 in #help
Sub domain auth
7 replies
BABetter Auth
Created by aswnss on 5/17/2025 in #help
How do you make fetch call from Nextjs to Hono with auth ?
The reason to not use the plugin is beacuse you have separated instance which is not nextjs. its a separate concern. The cookies will be automatically parsed if you have done the integrations in the docs correctly.
7 replies
BABetter Auth
Created by ChestnutWaffle on 5/15/2025 in #help
Elysia backend + Nextjs frontend, getSession issue
Also according to this problem with envs, maybe because the vars with NEXT_PUBLIC prefix are meant to be only used in client components?
16 replies
BABetter Auth
Created by ChestnutWaffle on 5/15/2025 in #help
Elysia backend + Nextjs frontend, getSession issue
I'm glad you got it working. Honestly, maybe I'm being too skeptical, but I feel like using authClient on the server side seems like an authentication design flaw and a potential security risk. That's why I prefer to fetch on the server.
16 replies
BABetter Auth
Created by aswnss on 5/15/2025 in #help
Next Hono session is empty
read the official integration guide carefully: https://www.better-auth.com/docs/integrations/hono
36 replies
BABetter Auth
Created by aswnss on 5/15/2025 in #help
Next Hono session is empty
this is very important
36 replies
BABetter Auth
Created by aswnss on 5/15/2025 in #help
Next Hono session is empty
also in the server you should use credentials include
36 replies
BABetter Auth
Created by aswnss on 5/15/2025 in #help
Next Hono session is empty
and when fetching in client use the authClient with credentials: "include"
36 replies
BABetter Auth
Created by aswnss on 5/15/2025 in #help
Next Hono session is empty
also when you are fetching on the server you shouldnt probably use the authclient
36 replies
BABetter Auth
Created by aswnss on 5/15/2025 in #help
Next Hono session is empty
what does the dev tools says
36 replies
BABetter Auth
Created by aswnss on 5/15/2025 in #help
Next Hono session is empty
have you tried in incognito
36 replies
BABetter Auth
Created by aswnss on 5/15/2025 in #help
Next Hono session is empty
allowHeaders: ["Content-Type", "Authorization"],
allowMethods: ["POST", "GET", "OPTIONS"],
exposeHeaders: ["Content-Length"],
maxAge: 600,
credentials: true,
allowHeaders: ["Content-Type", "Authorization"],
allowMethods: ["POST", "GET", "OPTIONS"],
exposeHeaders: ["Content-Length"],
maxAge: 600,
credentials: true,
36 replies
BABetter Auth
Created by aswnss on 5/15/2025 in #help
Next Hono session is empty
add those
36 replies
BABetter Auth
Created by aswnss on 5/15/2025 in #help
Next Hono session is empty
and as you said you should not use nextcookies in sepearte backend auth instance
36 replies
BABetter Auth
Created by aswnss on 5/15/2025 in #help
Next Hono session is empty
show your cors settings @aswnss
36 replies
BABetter Auth
Created by ChestnutWaffle on 5/15/2025 in #help
Elysia backend + Nextjs frontend, getSession issue
you can probably skip creating an endpoint and just fetch directly from /api/auth/get-session
16 replies
BABetter Auth
Created by ChestnutWaffle on 5/15/2025 in #help
Elysia backend + Nextjs frontend, getSession issue
import { cookies } from "next/headers";
import { Session } from "./auth-client";

const getServerSession = async (): Promise<Session | null> => {
try {

const cookieHeader = (await cookies()).toString();

const res = await fetch(`${process.env.API_URL}/v1/session`, {
credentials: "include",
headers: {
Cookie: cookieHeader,
},
});

return res.json();

} catch (error) {
console.error(error);
return null;
}
};

export default getServerSession;
import { cookies } from "next/headers";
import { Session } from "./auth-client";

const getServerSession = async (): Promise<Session | null> => {
try {

const cookieHeader = (await cookies()).toString();

const res = await fetch(`${process.env.API_URL}/v1/session`, {
credentials: "include",
headers: {
Cookie: cookieHeader,
},
});

return res.json();

} catch (error) {
console.error(error);
return null;
}
};

export default getServerSession;
16 replies
BABetter Auth
Created by ChestnutWaffle on 5/15/2025 in #help
Elysia backend + Nextjs frontend, getSession issue
i just created a endpoint that would get the session and i used this helper function
16 replies