joseph013318
joseph013318
BABetter Auth
Created by invocation97 on 2/7/2025 in #help
listUsers returns status 401 UNAUTHORIZED even though the current user is an admin.
@invocation97 Thankyou soo much 🙏 Was facing the same issue. They should include this in the docs
7 replies
BABetter Auth
Created by joseph013318 on 2/25/2025 in #help
Pending state not resolving!
Yes @Amit Sharma that would be better. I too was facing the issue but implement the above hack to solve for the time being!
9 replies
BABetter Auth
Created by joseph013318 on 2/25/2025 in #help
Pending state not resolving!
@Amit Sharma Yes same issue, but the update should fix the issue I guess. Check with better-auth 1.2.0 update, if still the same then you can try this code https://github.com/better-auth/better-auth/issues/1006#:~:text=last%20week-,I%20have%20solution.,-When%20component%20with
9 replies
BABetter Auth
Created by joseph013318 on 3/1/2025 in #help
While deploying - A Node.js API is used (process.exit at line: 1451) which is not supported in..
@Ping @lonelyplanet Yes using it in middleware. This is the exact code I used as in the better-auth docs https://www.better-auth.com/docs/integrations/next#middleware I need protected routes with auth! How do I solve the issue?
11 replies
BABetter Auth
Created by joseph013318 on 3/1/2025 in #help
While deploying - A Node.js API is used (process.exit at line: 1451) which is not supported in..
How to resolve the issue? I am deploying in vercel with better-auth as authentication
11 replies
BABetter Auth
Created by joseph013318 on 2/27/2025 in #help
Prisma database with Prisma orm showing Cache skipped reason: (auto no cache)
Oh okay understood. Actually prisma api was also hitting! Thankyou understood!
5 replies
BABetter Auth
Created by Muhammad Isa on 2/5/2025 in #help
Pending state is not changing even after the data is available.
Okay will try that! Thanks anyway!
18 replies
BABetter Auth
Created by Muhammad Isa on 2/5/2025 in #help
Pending state is not changing even after the data is available.
Yes, literally searched two days for the solution but couldn't find until I came across the above code. I don't wanna switch the auth I just love better-auth. I will try to reproduce the issue and share the code!
18 replies
BABetter Auth
Created by Muhammad Isa on 2/5/2025 in #help
Pending state is not changing even after the data is available.
Exactly!
18 replies
BABetter Auth
Created by Muhammad Isa on 2/5/2025 in #help
Pending state is not changing even after the data is available.
import { authClient } from "@/lib/auth-client"; import { useEffect, useRef } from "react"; function useBetterAuthSession() { const { data, isPending, error, //error object refetch, } = authClient.useSession(); // Track the latest value of isPending const isPendingRef = useRef(isPending); useEffect(() => { isPendingRef.current = isPending; }, [isPending]); useEffect(() => { if (isPending) { const timerNotify = setTimeout(() => { if (isPendingRef.current) { refetch(); // sends another get-session request to the server //authClient.$store.notify("$sessionSignal"); // or this poke store to trigger a re-render } }, 2500); // after 2.5 seconds of pending, force resetting client store const timerReload = setTimeout(() => { if (isPendingRef.current) { window.location.reload(); } }, 5000); // after 5 seconds of pending, reload the page return () => { clearTimeout(timerNotify); clearTimeout(timerReload); }; } }, [isPending]); return { data, isPending, error, }; } export default useBetterAuthSession; In mean time this worked, Someone suggested on github. (https://github.com/better-auth/better-auth/issues/1006#:~:text=last%20week-,I%20have%20solution,-.)
18 replies
BABetter Auth
Created by Muhammad Isa on 2/5/2025 in #help
Pending state is not changing even after the data is available.
In my navbar I am showing login button. When login is done in place of login button the profile card will appear so in mean time the loader is shown.
18 replies
BABetter Auth
Created by Muhammad Isa on 2/5/2025 in #help
Pending state is not changing even after the data is available.
@bekacru It's happening for me using Oauth and in worst prossible time almost going in production 😭, the loader is infinite sometimes. I will reproduce and share that same with you!
18 replies
BABetter Auth
Created by Muhammad Isa on 2/5/2025 in #help
Pending state is not changing even after the data is available.
Hey @Muhammad Isa have you found the solution?
18 replies
BABetter Auth
Created by joseph013318 on 2/25/2025 in #help
Session cookies issue
lib/auth-client.js import { createAuthClient } from "better-auth/react" export const authClient = createAuthClient({ baseURL: process.env.NEXT_PUBLIC_APP_URL, // the base url of your auth server }) export const { signIn, signOut, useSession, getSession } = authClient; Session check of Login button login.jsx const { data: session, isPending, //loading state } = authClient.useSession(); console.log("session: ", session);
2 replies
BABetter Auth
Created by joseph013318 on 2/24/2025 in #help
How to integrate better-auth with cloudfare D1 database?
Wow superb @Ping and @lonelyplanet for the help ❤️ Love the community support 🙏
7 replies
BABetter Auth
Created by joseph013318 on 2/23/2025 in #help
Multiple session for user
Ohh okay. Thank you @lonelyplanet
5 replies