New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate ReCaptcha v3 / v2 with SvelteKit Superforms #323
Comments
I've been trying to do this as well. The problem i'm having is getting the token on the client and sending it to an action on the server. I tried using onSubmit with an async..await to get the ReCaptcha token on the client, add it to formData and submit but that didn't work. I went outside use:enhance with a function call via on:submit|preventDefault={onFormSubmit} but it gets executed too late for the server action to get the token to query Google. I need the server action to hold off until the client side function call has completed. I thought simple enough, but proving tricky with Superforms in the mix. |
Had this working quite shortly after my last post as below, getting into the swing of Superforms, it's a very nice package :) I say yes to 'browser error' from Google, not a good idea but hey, it's generally just a guide. I added localhost to the approved domains on the Google side for development. +page.svelte
/api/lostpassword/+server.ts
|
I solve it the following way: $lib/helpers/recaptcha.ts
+page.svelte
+page.server.ts
Hope it helps |
Hi team,
Thank you for a great package.
I have tried to integrate ReCaptcha with your package, but I don't know what is the best way to implement it.
can you provide example on the site or in the repo.
Thanks.
The text was updated successfully, but these errors were encountered: