Nextjs 13 ReCAPTCHA
HTML-код
- Опубликовано: 7 фев 2025
- Packages used:
www.npmjs.com/...
www.npmjs.com/...
Get keys from ReCAPTCHA:
www.google.com...
To learn more about server & client components:
• Next.js 13 Update | Ep...
Need a website? Check us out: fabled-web.ca
I'd love to see the server side part of this video! Nice work
Thank you for this tutorial. you deserve more views and subscribers
Thank you! Helped me out a lot! Cheers from Brazil!
Very glad you found the content helpful 😁
Very good tutorial!!
The only working tutorial
i'm right with you
Better help than Chatgpt!!
Thank you.
Nice, that's exactly what I am needing right now. Would be also nice to see how to verify this on the server side, maybe with express? :)
Most likely will do a video on that. Also with different serverless environments😁
thank you
Can this package be used for v3 as well?
hey ben , after some time the recaptcha gets expired and I'm unable to reset it after submit how can I reset it
nice video , sonks
Nice video but would have been even better if it covered the server side
So is this enough for a normal contact form?
Btw Thanks for the great tutorial.
For a simple contact yeah, you can handle it all client side. Keep in mind though without server verification it can receive malicious requests if someone with technical know-how wants to hurt you/your site.
For a basic site, you will be fine.
@@benhaig I implemented a function using next js server action to verify the captcha. can you tell me this function is correct or not?
export async function verifyCaptchaAction(token: string | null) {
try {
const secretKey = process.env.RECAPTCHA_SECRET_KEY;
const response = await fetch(
`www.google.com/recaptcha/api/siteverify?secret=${secretKey}&response=${token}`,
{
method: 'POST',
}
);
if (response.ok) {
return true;
} else {
throw new Error("reCAPTCHA response failed");
}
} catch (error) {
throw new Error(`An error occurred during reCAPTCHA verification: ${error}`);
}
}
Thank You
thank you