wvn
wvn
Explore posts from servers
BABetter Auth
Created by wvn on 4/10/2025 in #help
Polar
Hi, im creating a licensing website and i want to make if user buy the product it will insert it ( or run API ) in the dtb. Is it possible with polar to automatically insert or i do need to create a redeem key that will redeem - add the license?
2 replies
BABetter Auth
Created by wvn on 4/8/2025 in #help
Admin Role
Hello, how can i manually set a user role ( Like example admin - In the database ) ?
4 replies
BABetter Auth
Created by wvn on 4/5/2025 in #help
Backup Verify
No description
30 replies
BABetter Auth
Created by wvn on 4/5/2025 in #help
OTP
No description
4 replies
BABetter Auth
Created by wvn on 4/5/2025 in #help
Error generating backup codes
Hello, im trying to generate a backup codes for a user. But i have this kind of error when generating backup codes. How can i fix it ? Where did i do problem ?
const handleVerifyCode = async (e: React.FormEvent) => {
e.preventDefault();
try {
await authClient.twoFactor.verifyTotp({
code: verificationCode
});
console.log(password)

const { data, error } = await authClient.twoFactor.generateBackupCodes({
password: password
})

console.log(data)

if (data) {
setBackupCodes(data.backupCodes);
setShowBackupCodes(true);
toast.success("2FA enabled successfully!");
}
} catch (error) {
toast.error("Invalid verification code");
}
};
const handleVerifyCode = async (e: React.FormEvent) => {
e.preventDefault();
try {
await authClient.twoFactor.verifyTotp({
code: verificationCode
});
console.log(password)

const { data, error } = await authClient.twoFactor.generateBackupCodes({
password: password
})

console.log(data)

if (data) {
setBackupCodes(data.backupCodes);
setShowBackupCodes(true);
toast.success("2FA enabled successfully!");
}
} catch (error) {
toast.error("Invalid verification code");
}
};
Error generating backup codes: [Error [APIError]: ] { status: 'UNAUTHORIZED', body: undefined, headers: {}, statusCode: 401 } POST /api/auth/two-factor/generate-backup-codes 500 in 54ms
5 replies
BABetter Auth
Created by wvn on 4/5/2025 in #help
2FA Totp
No description
10 replies
BABetter Auth
Created by wvn on 4/5/2025 in #help
Get session
Hello, im trying to redirect not authenticated user to login page. But it does not redirect me My code:
"use client";
import { authClient } from "@/lib/auth-client"
import { useRouter } from "next/navigation";

export default function DashboardPage() {
const { data: session } =authClient.getSession();
const router = useRouter();
if (!session) {
router.push("/sign-in");
}

return (
<div>
<h1>Dashboard</h1>
</div>
);
}
"use client";
import { authClient } from "@/lib/auth-client"
import { useRouter } from "next/navigation";

export default function DashboardPage() {
const { data: session } =authClient.getSession();
const router = useRouter();
if (!session) {
router.push("/sign-in");
}

return (
<div>
<h1>Dashboard</h1>
</div>
);
}
Where did i do it wrong ?
5 replies
DIAdiscord.js - Imagine an app
Created by wvn on 4/2/2025 in #djs-questions
Learn d.js
Hello, what is the best way to learn discord.js with typescript ?
10 replies