Katsu
Katsu
BABetter Auth
Created by Katsu on 2/28/2025 in #help
Calling signIn.social with extended field data.
So I've added an additional field on my user in my server side auth
user: {
additionalFields: {
username: {
type: "string",
required: true,
unique: true,
},
},
},
user: {
additionalFields: {
username: {
type: "string",
required: true,
unique: true,
},
},
},
The issue I'm running into now is once I try to sign in with OAuth, i.e.
const data = await authClient.signIn.social({
provider: "google",
callbackURL: "http://localhost:3000/dashboard",
});
const data = await authClient.signIn.social({
provider: "google",
callbackURL: "http://localhost:3000/dashboard",
});
The issue is I get an error because there is no field for the username now.
2025-02-27 23:11:39 2025-02-28T07:11:39.578Z ERROR [Better Auth]: error: null value in column "username" of relation "users" violates not-null constraint
2025-02-27 23:11:39 2025-02-28T07:11:39.578Z ERROR [Better Auth]: unable_to_create_user
2025-02-27 23:11:39 2025-02-28T07:11:39.578Z ERROR [Better Auth]: error: null value in column "username" of relation "users" violates not-null constraint
2025-02-27 23:11:39 2025-02-28T07:11:39.578Z ERROR [Better Auth]: unable_to_create_user
Is there any way to pass in additional/extended fields in social sign ins?
5 replies