All Projects → johndatserakis → vue-programmatic-invisible-google-recaptcha

johndatserakis / vue-programmatic-invisible-google-recaptcha

Licence: MIT License
🔒A simple invisible Google reCAPTCHA component focused solely on programmatic invocation.

Programming Languages

Vue
7211 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to vue-programmatic-invisible-google-recaptcha

invisible-recaptcha
An invisible reCAPTCHA package for Laravel, Lumen, CI or native PHP.
Stars: ✭ 15 (-46.43%)
Mutual labels:  recaptcha, invisible
Contact-Form-PHP
Simple and secure contact form using Ajax, validations inputs, SMTP protocol and Google reCAPTCHA v3 in PHP.
Stars: ✭ 28 (+0%)
Mutual labels:  recaptcha
am-i-human
自分が人間か不安になったときに使うページ
Stars: ✭ 68 (+142.86%)
Mutual labels:  recaptcha
recaptcha
Google reCAPTCHA v2 PHP class
Stars: ✭ 41 (+46.43%)
Mutual labels:  recaptcha
reCAPTCHA
‼️ Google reCAPTCHA (security) for Nette Framework \ Forms
Stars: ✭ 35 (+25%)
Mutual labels:  recaptcha
Captcha-Tools
All-in-one Python (And now Go!) module to help solve captchas with Capmonster, 2captcha and Anticaptcha API's!
Stars: ✭ 23 (-17.86%)
Mutual labels:  recaptcha
react-native-recaptcha-that-works
⚛ A reCAPTCHA bridge for React Native that works (Android and iOS)
Stars: ✭ 90 (+221.43%)
Mutual labels:  recaptcha
ContactEtc
Laraval package to instantly add a customisable contact form to your site.
Stars: ✭ 21 (-25%)
Mutual labels:  recaptcha
Codeigniter-recaptcha
CodeIgniter library to use Google's reCAPTCHA V2
Stars: ✭ 25 (-10.71%)
Mutual labels:  recaptcha
go-coinmarketcap
The Unofficial Coin Market Cap API client for Go.
Stars: ✭ 61 (+117.86%)
Mutual labels:  v2
edgekit
Open source, privacy focused client side library for the creation and monetisation of online audiences.
Stars: ✭ 42 (+50%)
Mutual labels:  programmatic
instacop
InstaCop — Enhanced shopping experience for the adidas.com online store 🦓
Stars: ✭ 68 (+142.86%)
Mutual labels:  recaptcha
2captcha-go
Golang Module for easy integration with the API of 2captcha captcha solving service to bypass recaptcha, hcaptcha, funcaptcha, geetest and solve any other captchas.
Stars: ✭ 31 (+10.71%)
Mutual labels:  recaptcha
captcha-solver
Library and CLI for automating captcha verification across multiple providers.
Stars: ✭ 101 (+260.71%)
Mutual labels:  recaptcha
vscode-autohotkey2-lsp
Autohotkey2 Language Support using vscode-lsp.
Stars: ✭ 24 (-14.29%)
Mutual labels:  v2
laravel-survey
Laravel 6 survey app.
Stars: ✭ 39 (+39.29%)
Mutual labels:  recaptcha
authentication-service
Authentication microservice. The integration only requires redirects and JWT tokens
Stars: ✭ 19 (-32.14%)
Mutual labels:  recaptcha
opensea automatic uploader
(Bypass reCAPTCHAs) A Selenium Python bot to automatically and bulky upload and list your NFTs on OpenSea (all metadata integrated - Ethereum and Polygon supported); reCAPTCHA solver & bypasser included.
Stars: ✭ 205 (+632.14%)
Mutual labels:  recaptcha
wagtail-django-recaptcha
A simple recaptcha field for Wagtail Form Pages
Stars: ✭ 47 (+67.86%)
Mutual labels:  recaptcha
Pancakeswap-sniping-bot-demo
Pancakeswap v1 and v2 sniping bot demo. Contact @aviddotsupports for full version on telegram or contact AviddotSupport#8131 on Discord
Stars: ✭ 146 (+421.43%)
Mutual labels:  v2

vue-programmatic-invisible-google-recaptcha

A simple invisible Google reCAPTCHA component focused solely on programmatic invocation.

NPM Version NPM Downloads License Tweet

Demo

View demo

View on npm

View on GitHub

Install

# npm
npm i vue-programmatic-invisible-google-recaptcha

# yarn
yarn add vue-programmatic-invisible-google-recaptcha

Or you can include it through the browser at the bottom of your page:

<!-- Please note if you're using the browser method you're going to want to adjust the version number as needed. -->

<script src="https://unpkg.com/[email protected]/dist/vue-programmatic-invisible-google-recaptcha.min.js"></script>

About

This is a simple component that helps deal with an invisible Google reCAPTCHA that you intend to invoke programmatically. There are a few plugins that help with Google's reCAPTCHA, but this one is focused on the invisble version with a programmatic invocation only. Due to its nature, reCAPTCHA can be a little complex - so that is what is driving the narrow scope here. Library supports easy multiple reCAPTCHAs on the same page.

Here's a breakdown of the steps you go through when using this library:

  • Load the Google reCAPTCHA library using the provided script tag.
  • Whenever you'd like, invoke the reCAPTCHA using this.$refs.invisibleRecaptcha1.execute() method (replacing invisibleRecaptcha1 with the ref name you set).
  • Google will either decide to show a challange or not. Either way, you'll get the recaptchaToken in the registered recaptcha-callback event. Make sure to register for that.
  • Use that token to verify in your backend.
  • Call the method again if you'd like to get a new token.

Usage Example

import VueProgrammaticInvisibleGoogleRecaptcha from 'vue-programmatic-invisible-google-recaptcha'
Vue.component('vue-programmatic-invisible-google-recaptcha', VueProgrammaticInvisibleGoogleRecaptcha)
<!-- Put this in your base HTML file - I use Vue CLI 3 so I put it at the bottom of the ./public/index.html file. -->
<script src="https://www.google.com/recaptcha/api.js?render=explicit" async defer></script>

<!-- This is in the component you want to have the reCAPTCHA -->
<vue-programmatic-invisible-google-recaptcha
    ref="invisibleRecaptcha1"
    :sitekey="'<YOUR_SITEKEY_HERE>'"
    :elementId="'invisibleRecaptcha1'"
    :badgePosition="'left'"
    :showBadgeMobile="false"
    :showBadgeDesktop="true"
    @recaptcha-callback="recaptchaCallback"
></vue-programmatic-invisible-google-recaptcha>

<!-- Where you want to invoke the reCAPTCHA -->
submitButtonClicked() {
    // Do whatever you want here (probably some validation). After
    // that's done (or passed your expectations) you can then invoke the reCAPTCHA.
    this.$refs.invisibleRecaptcha1.execute()
},

<!-- The reCAPTCHA's registered callback. This is where you'll get your token. -->
recaptchaCallback (recaptchaToken) {
    // Use the `recaptchaToken` to pass to your backend to verify the token
    axios.post('/enter', {recaptchaToken: recaptchaToken}).then((result) => {
        console.log(result)
    })
},

Note - I find it to be a good idea to allow the user to reset their reCAPTCHA on their own if they're experiencing an issue. This component exposes a function for this. To do this, give them a button with the following code in the click function: this.$refs.invisibleRecaptcha1.reset(). This will reset the reCAPTCHA and hopefully get them passed the issue they're having.

Props

prop type description required default
ref String Unique String gives you control over the component Yes
sitekey String Public key given to you by Google. Yes
elementId String Unique String for the id of the element. Allows for multiple seperate reCAPTCHAs Yes
badgePosition String Pass 'left' to show badge on left side of screen. No 'right'
showBadgeMobile Boolean true to show badge on mobile. false to hide badge on mobile. No true
showBadgeDesktop Boolean true to show badge on desktop. false to hide badge on desktop. No true

Methods

Note - call these methods through the ref you set up with your component. Example: this.$refs.invisibleRecaptcha1.execute().

method parameters description
execute none Used to gather the token. If Google decides that the user needs to complete a test they'll do it here.
reset none Used to reset the reCAPTCHA instance.

Events

event parameter value description
recaptcha-callback String This even gets emitted when the token has been aquired. You can then use this token to verify the user on your backend.

Development

# install dependencies
npm install

# serve with hot reload
npm run watch

# run the tests
npm run test

# build demo page
npm run build:example

# build library
npm run build:library

# build everything and run tests
npm run build

Other

Go ahead and fork the project! Submit an issue if needed. Have fun!

Thank You

Thanks to Google for their reCAPTCHA library.

License

MIT

Packaged with a mixture of vue-lib-template and vue-sfc-rollup.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].