Arthur Mendes
Arthur Mendes
BABetter Auth
Created by Arthur Mendes on 4/4/2025 in #help
Getting FORBIDDEN (403) error when using authClient.admin
Great, appreciate it!
17 replies
BABetter Auth
Created by Arthur Mendes on 4/4/2025 in #help
Getting FORBIDDEN (403) error when using authClient.admin
Ok, how can I get notified when it's released?
17 replies
BABetter Auth
Created by Arthur Mendes on 4/4/2025 in #help
Getting FORBIDDEN (403) error when using authClient.admin
Sorry about my english, I'm Brazilian.
17 replies
BABetter Auth
Created by Arthur Mendes on 4/4/2025 in #help
Getting FORBIDDEN (403) error when using authClient.admin
@Ping I tried yarn add better-auth@latest but I doesn't fixed yet. Do i have to do something else?
17 replies
BABetter Auth
Created by Arthur Mendes on 4/4/2025 in #help
Getting FORBIDDEN (403) error when using authClient.admin
Nice, thank you so much!
17 replies
BABetter Auth
Created by Arthur Mendes on 4/4/2025 in #help
Getting FORBIDDEN (403) error when using authClient.admin
No description
17 replies
BABetter Auth
Created by Arthur Mendes on 4/4/2025 in #help
Getting FORBIDDEN (403) error when using authClient.admin
Is generated from Prisma
17 replies
BABetter Auth
Created by Arthur Mendes on 4/4/2025 in #help
Getting FORBIDDEN (403) error when using authClient.admin
No description
17 replies
BABetter Auth
Created by Arthur Mendes on 4/4/2025 in #help
Getting FORBIDDEN (403) error when using authClient.admin
I'm using @casl to RBAC:
register: privateProcedure
.input(
z.object({
email: z.string().email(),
name: z.string(),
password: z.string(),
document: z.string(),
role: z.nativeEnum(Role).optional(),
})
)
.mutation(async ({ input, ctx }) => {
console.log(ctx.user);
ctx.throw("Você não tem permissão para cadastrar usuário").ifCannot("create", "user");

const data = await auth.api.createUser({
headers: await headers(),
body: {
email: input.email,
name: input.name,
password: input.password,
data: { document: input.document },
},
});

await prisma.user.update({ where: { id: data.user.id }, data: { role: input.role } });

await ctx.log("registerUser", { createdUserId: data.user.id });

return data;
}),
register: privateProcedure
.input(
z.object({
email: z.string().email(),
name: z.string(),
password: z.string(),
document: z.string(),
role: z.nativeEnum(Role).optional(),
})
)
.mutation(async ({ input, ctx }) => {
console.log(ctx.user);
ctx.throw("Você não tem permissão para cadastrar usuário").ifCannot("create", "user");

const data = await auth.api.createUser({
headers: await headers(),
body: {
email: input.email,
name: input.name,
password: input.password,
data: { document: input.document },
},
});

await prisma.user.update({ where: { id: data.user.id }, data: { role: input.role } });

await ctx.log("registerUser", { createdUserId: data.user.id });

return data;
}),
This is my code on TRPC, but keeps getting the same error.
17 replies