Password null on signUp POST

hello my password sends as null when trying to register a user! there is no docs about it can you hep
4 Replies
lonelyplanet
lonelyplanet2w ago
Do you mind sharing your auth config auth.ts your auth-client.ts and where you are calling the .signUp method in your code
Morgan | Freelance Marketing
import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { db } from "@/db";
import * as schema from "@/db/schema";

export const auth = betterAuth({
database: drizzleAdapter(db, {
provider: "pg",
schema
}),
user: {
modelName: "users" // Matches your schema key
},
emailAndPassword: {
enabled: true,
autoSignIn: false
}
});
import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { db } from "@/db";
import * as schema from "@/db/schema";

export const auth = betterAuth({
database: drizzleAdapter(db, {
provider: "pg",
schema
}),
user: {
modelName: "users" // Matches your schema key
},
emailAndPassword: {
enabled: true,
autoSignIn: false
}
});
import { createAuthClient } from "better-auth/react"
export const authClient = createAuthClient({
baseURL: "http://localhost:3000" // the base url of your auth server
})

export const { signIn, signUp, useSession } = createAuthClient()
import { createAuthClient } from "better-auth/react"
export const authClient = createAuthClient({
baseURL: "http://localhost:3000" // the base url of your auth server
})

export const { signIn, signUp, useSession } = createAuthClient()
if (isRegister) {

console.log(formData)
const {email, password, username} = formData;
const { data, error } = await authClient.signUp.email({

email, // user email address
password: "password",
name: username,
callbackURL: "/dashboard" // a url to redirect to after the user verifies their email (optional)
}, {
onRequest: (ctx) => {
console.log(email, password, username) },
onSuccess: (ctx) => {
setTimeout(() => router.push("/verifyUser"), 2000); // Redirect after 2s
},
onError: (ctx) => {
// display the error message
console.log(ctx.error.message);
},
});

}
if (isRegister) {

console.log(formData)
const {email, password, username} = formData;
const { data, error } = await authClient.signUp.email({

email, // user email address
password: "password",
name: username,
callbackURL: "/dashboard" // a url to redirect to after the user verifies their email (optional)
}, {
onRequest: (ctx) => {
console.log(email, password, username) },
onSuccess: (ctx) => {
setTimeout(() => router.push("/verifyUser"), 2000); // Redirect after 2s
},
onError: (ctx) => {
// display the error message
console.log(ctx.error.message);
},
});

}
bekacru
bekacru2w ago
password is stored in the accounts table incase you were looking for it in a user table
Morgan | Freelance Marketing
how should i proceed

Did you find this page helpful?