deleteUser response: FAILED_TO_GET_USER_INFO

Hi, I'm using deleteUser() with sendDeleteAccountVerification. E-mail is sent with correct token. But whatever I try, the response from my Express API is FAILED_TO_GET_USER_INFO. I'm on version 1.2.7 in both client and server Does anyone have a clue of why this response is returned?
3 Replies
Ping
Ping2w ago
Can I see your auth config?
Wietse
WietseOP3d ago
Hi @Ping , thanks for your response. Excuse me for my late response, I was out for a few days. This is my client config: baseURL: import.meta.env.VITE_API_BASE_URL, fetchOptions: { credentials: "include", auth: { type: "Bearer", token: await getToken(), }, } This is my Express API config: authInstance = betterAuth({ plugins: [bearer()], database: mongodbAdapter(nativeDb), trustedOrigins: ["http://localhost:3000", "http://localhost:3001"], emailAndPassword: { enabled: true, sendResetPassword: async ({ user, url }) => { var message = { from: "removed actual email address, but it's being sent/received", to: user.email, subject: "test", text: "Hi " + user.name + ",\n\n Follow the link below to reset your password: \n" + url.toString(), html: <p>Hi ${user.name}</p><p>Follow the link below to reset your password:<br /><a href="${url.toString()}">Reset password</a></p>, }; transporter.sendMail(message, (err) => { if (err) { console.log("Error occurred. " + err.message); return process.exit(1); } }) }, }, user: { deleteUser: { enabled: true, sendDeleteAccountVerification: async ( { user, // The user object url, // The auto-generated URL for deletion }, request // The original request object (optional) ) => { var message = { from: "removed actual email address, but it's being sent/received", to: user.email, subject: "delete user", text: "Hi " + user.name + ",\n\n Follow the link below to remove your account: \n" + url.toString(), };
transporter.sendMail(message, (err) => { if (err) { console.log("Error occurred. " + err.message); return process.exit(1); } }) }, }, } }); @Ping can I politely ask you to have another look?
Ping
Ping3d ago
That error occurs when there isn't an active session Are you using auth.api.deleteUser? or using the authClient?

Did you find this page helpful?