Alan_szt
Alan_szt
Explore posts from servers
BABetter Auth
Created by Alan_szt on 4/26/2025 in #help
Open api with exchange token
Hey! I need to create a public API (machine to machine) where our users will have to generate a key. the key is created by a user but attached to a company (1 user belong to many company, 1 company has many users) This is the flow: 1. user creates a key "A" in the context of a company 2. 3rd party application hits an endpoint /oauth/access. Our service respond with a token "B" valid 30 min. 3. 3rd party application can use all other endpoints with token "B" Can we achieve this with bettaurAuth? can we use this feature? https://www.better-auth.com/docs/plugins/api-key? I dont see anything regarding the exchange of tokens Thanks
2 replies
DTDrizzle Team
Created by Alan_szt on 3/29/2025 in #help
Keyword "with" is not typed
Hello. I need some help here. https://github.com/drizzle-team/drizzle-orm/issues/4297 Any idea why the keyword "with" is not typed
1 replies
BABetter Auth
Created by Alan_szt on 3/28/2025 in #help
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);
},
}
5 replies
DTDrizzle Team
Created by Alan_szt on 2/3/2025 in #help
I don't understand why the keyword `with` is not working.
No description
7 replies
TtRPC
Created by Alan_szt on 7/18/2024 in #❓-help
How can I set a Cookie from the server (for the login)?
No description
4 replies
TtRPC
Created by Alan_szt on 7/18/2024 in #❓-help
How to get access to the types generated by the server in the frontend (React)?
In this example, how do you replace data: any to the correct type?
import { trpc } from "../utils/trpc";

type Props = {
onSuccess: (data: any) => void;
};
export function CreateWorker(props: Props) {
const createWorkerMutation = trpc.createWorker.useMutation();

const handleCreateWorker = () => {
createWorkerMutation.mutate(
{ data: "hello" },
{
onSuccess: (data) => props.onSuccess(data),
}
);
};
return <button onClick={handleCreateWorker}>create</button>;
}
import { trpc } from "../utils/trpc";

type Props = {
onSuccess: (data: any) => void;
};
export function CreateWorker(props: Props) {
const createWorkerMutation = trpc.createWorker.useMutation();

const handleCreateWorker = () => {
createWorkerMutation.mutate(
{ data: "hello" },
{
onSuccess: (data) => props.onSuccess(data),
}
);
};
return <button onClick={handleCreateWorker}>create</button>;
}
3 replies