Exclude role in the signup (frontend) as it should be driven from the backend

Hey Guys, I added the field role So i added this in React: export const authClient = createAuthClient({ plugins: [inferAdditionalFields({ user: { role: { type: "string" } } })], but now, when a user signup, we should not ask for role... this field should not be driven by the frontend.. How can exclude it? #help
const data = await authClient.signUp.email(
{
email,
password,
name,
role: "CLIENT", // TODO: remove this
},
{
onRequest: (ctx) => {
console.log("onRequest", ctx);
//show loading
},
onSuccess: (ctx) => {
console.log("onSuccess", ctx);
//redirect to the dashboard or sign in page
},
onError: (ctx) => {
// display the error message
console.log("onError", ctx);
},
}
const data = await authClient.signUp.email(
{
email,
password,
name,
role: "CLIENT", // TODO: remove this
},
{
onRequest: (ctx) => {
console.log("onRequest", ctx);
//show loading
},
onSuccess: (ctx) => {
console.log("onSuccess", ctx);
//redirect to the dashboard or sign in page
},
onError: (ctx) => {
// display the error message
console.log("onError", ctx);
},
}
3 Replies
bekacru
bekacru5d ago
you can pass input:false in the field config on your auth config
Alan_szt
Alan_sztOP4d ago
I did what you suggest but I still have a typescript error in react in the signup mutation.. it expects the role
bekacru
bekacru2d ago
Could you share your auth config?

Did you find this page helpful?