Glen Kurio
Glen Kurio
Explore posts from servers
BABetter Auth
Created by Glen Kurio on 4/29/2025 in #help
useSession returns null for data in Next.js
That's it. 🤦‍♂️ Thank you
23 replies
BABetter Auth
Created by Glen Kurio on 4/29/2025 in #help
useSession returns null for data in Next.js
Could you help, please ? @Ping
23 replies
BABetter Auth
Created by Glen Kurio on 4/29/2025 in #help
useSession returns null for data in Next.js
And I import createAuthClient from the right place:
import { createAuthClient } from "better-auth/react";
import { createAuthClient } from "better-auth/react";
23 replies
BABetter Auth
Created by Glen Kurio on 4/29/2025 in #help
useSession returns null for data in Next.js
I set nextCookies plugin in BA Config as a last one in the array of plugins
23 replies
BABetter Auth
Created by Glen Kurio on 4/20/2025 in #bug-reports
Stripe plugin create a new customer on subscription.upgrade click.
@bekacru Can you help us out with this?
5 replies
BABetter Auth
Created by Glen Kurio on 4/20/2025 in #bug-reports
Stripe plugin create a new customer on subscription.upgrade click.
Still have no idea. No response. I just implemented Stripe separately.
5 replies
BABetter Auth
Created by omero on 4/23/2025 in #help
How can I do multiple Database calls 'during' user creation transaction in google OAuth?
9 replies
BABetter Auth
Created by omero on 4/23/2025 in #help
How can I do multiple Database calls 'during' user creation transaction in google OAuth?
I can give and example of how I handled google OAuth flow when used the Lucia if you want
9 replies
BABetter Auth
Created by omero on 4/23/2025 in #help
How can I do multiple Database calls 'during' user creation transaction in google OAuth?
I mean you can try to hook up into OAuth flow of better auth by specifying the custom redirectURI for provider in auth config an doing your transaction there . link to docs: https://www.better-auth.com/docs/concepts/oauth You will need to handle this part by yourself then I guess: https://www.better-auth.com/docs/concepts/oauth#post-login-flow
9 replies
BABetter Auth
Created by Glen Kurio on 4/20/2025 in #help
Stripe plugin triggers multiple create customer events in Stripe
Any updates on this, please?
3 replies
BABetter Auth
Created by nktnet on 1/1/2025 in #help
Typescript - database hook type inference for additional fields
and what do you mean by not added ? To db? you need to generate the schema after you modified the auth.ts config: npx @better-auth/cli generate or migrate (works with kysely only)
9 replies
BABetter Auth
Created by nktnet on 1/1/2025 in #help
Typescript - database hook type inference for additional fields
For type to be picked up you need to infer it: in auth.ts: export type User = typeof auth.$Infer.Session.user; in auth-client:
export const authClient = createAuthClient({
baseURL: process.env.NEXT_PUBLIC_APP_URL,
plugins: [
stripeClient({
subscription: true, //if you want to enable subscription management
}),
inferAdditionalFields<typeof auth>(),
],
});
export const authClient = createAuthClient({
baseURL: process.env.NEXT_PUBLIC_APP_URL,
plugins: [
stripeClient({
subscription: true, //if you want to enable subscription management
}),
inferAdditionalFields<typeof auth>(),
],
});
9 replies
BABetter Auth
Created by JROCBABY on 4/23/2025 in #help
https://www.better-auth.com/docs/plugins/passkey
No worries, happens to the best of us ! 😇
6 replies
BABetter Auth
Created by JROCBABY on 4/23/2025 in #help
https://www.better-auth.com/docs/plugins/passkey
run npx @better-auth/cli generate and update your schema manually. Migrate: This command creates the required tables directly in the database. (Available only for the built-in Kysely adapter)
6 replies
BABetter Auth
Created by RiLeX98 on 4/16/2025 in #help
How to set CallbackURL in emailVerification
Otherwise callback in signUp/In.email is used to redirect user after successful email verification
3 replies
BABetter Auth
Created by RiLeX98 on 4/16/2025 in #help
How to set CallbackURL in emailVerification
You can specify the callback URL only when triggering sendVerificationEmail manually:
await authClient.sendVerificationEmail({
callbackURL: "/" // The redirect URL after verification
})
await authClient.sendVerificationEmail({
callbackURL: "/" // The redirect URL after verification
})
https://www.better-auth.com/docs/concepts/email#3-manually
3 replies
BABetter Auth
Created by Glen Kurio on 4/14/2025 in #help
Avatar Upload Issue: Session Cookie Size and Upload Timing
Yes, and if sign up fails - we'll have orphaned images in storage.
5 replies
BABetter Auth
Created by maito on 4/13/2025 in #help
Handling error of forgetPassword call
only in local dev though . It is a bit strange as it returns 204 in my case in prod but triggers onError callback. Does anyone knows why ?
8 replies
BABetter Auth
Created by maito on 4/13/2025 in #help
Handling error of forgetPassword call
I can throw custom error in hook:
if (ctx.path === "/forget-password") {
const validationResult = forgotPasswordSchema.safeParse(ctx.body);

if (!validationResult.success) {
console.log(validationResult.error.errors);
throw new APIError("BAD_REQUEST", {
message: validationResult.error.errors[0]?.message,
});
}

const dbUser = await db
.select()
.from(user)
.where(eq(user.email, ctx.body.email))
.then((r) => r[0]);

if (!dbUser) {
throw new APIError("NOT_FOUND", {
message: "Provided email is not registered",
});
}
}
if (ctx.path === "/forget-password") {
const validationResult = forgotPasswordSchema.safeParse(ctx.body);

if (!validationResult.success) {
console.log(validationResult.error.errors);
throw new APIError("BAD_REQUEST", {
message: validationResult.error.errors[0]?.message,
});
}

const dbUser = await db
.select()
.from(user)
.where(eq(user.email, ctx.body.email))
.then((r) => r[0]);

if (!dbUser) {
throw new APIError("NOT_FOUND", {
message: "Provided email is not registered",
});
}
}
And handle it on the client:
onError: async (ctx) => {
if (ctx.error.status === 429) {
toast(
<div className="flex flex-shrink-0 items-start gap-2 p-0">
<IconExclamationCircle className="h-full w-5 text-amber-500" />
<div className="flex flex-col gap-1">
<h6 className="text-sm">Too many Requests.</h6>
<p className="text-xs">
Please try again in couple minutes or contact support.
</p>
</div>
</div>,
{},
);
} else {
toast.error(ctx.error.message);
}
},
onError: async (ctx) => {
if (ctx.error.status === 429) {
toast(
<div className="flex flex-shrink-0 items-start gap-2 p-0">
<IconExclamationCircle className="h-full w-5 text-amber-500" />
<div className="flex flex-col gap-1">
<h6 className="text-sm">Too many Requests.</h6>
<p className="text-xs">
Please try again in couple minutes or contact support.
</p>
</div>
</div>,
{},
);
} else {
toast.error(ctx.error.message);
}
},
It displays the text of my error on the client in the toast
8 replies
BABetter Auth
Created by maito on 4/13/2025 in #help
Handling error of forgetPassword call
Rate limit is not applied to /forget-password path for some reason. Despite I have this custom rule: "/forget-password": { window: 300, max: 1, }, I can send as many 'forget password emails' as I want as long as I provide existing email
8 replies