How to Integrate Google recaptcha on AngularJS

Posted By : Swati Rahangdale | 13-Dec-2017

 

 

 

 

 

How to Integrate Google recaptcha on AngularJS

 

 

 

 

I am implementing recaptcha in Angular JS I am using https://www.google.com/recaptcha/, url as reference. I have referred the Usage section and followed the instructions of code but still able to get recaptcha in registration page.The client-side use angular-recaptcha library. This library will make it simple to help reCaptcha in our angular.The client-side use angular-recaptcha library. This library will make it simple to help reCaptcha in our angular.

 

Two Sections:

 

These are following two sections

1 Client side implementation:

  • The new set up new angular js project

  • Show reCaptcha Refrence

  • Take the g-captcha-response after user check.

     

A new signin form with AngularJS. Add new AngularJS library and Boostrap html ,css files.

The angular component controller defined. We have a new signin form setup new field such as name , email and password fields and used in Angular controller.

First injected google recpacha vcRecaptchaService into our controller injected http service which we will uesd to make ajax desire to the server.

 

Eg: app.js

 

 

 

 

(function(){
angular.module('angularRecaptcha',[])

.controller('recapCtrl',[function(){
var vm = this;

vm.signup = function(){

}
}])
})()

 

 

 

 

Display reCaptcha

 

Angular-recaptcha for our client side implementation.

Add the raised line in head html tag. The basic advise of angular-recaptcha library that reCaptcha api is ready for usage.

angular-recaptcha library and include the js file and components in your project. You can install it using npm bower command or Now inject the vcRecaptcha as need into you angular module.

 

Eg:

 

 

 

 

<!--Recaptcha Widget--->
< div recaptcha key = "recap.publicKey" >< / div >

Eg:

 

 

 

 

 

controller ( 'recapCtrl' , [ function ( ) {
var vm = this ;

vm. publicKey = "site-----KEY---" ;

vm. signup = function ( ) {

}

Schedule your won website to account on Google reCaptcha utility

 

2 Server side implementation

  • Check the user response with Google

Schedule you won website for reCaptcha sign in with your Google account. Fill the register your project domain specifics and register. The successfully archives Google provides with a new site key and a secret key.

 

New Site Key: This will be help on client side code used this key.

New Secret Key: This will be help on server side code used this key.

Then next to reCaptcha integration.

 

Captcha’s are a need to satisfy your website from a messages but some times they can show the certaion users, Google’s new reCaptcha makes it need easier for humans to pass, at the same time making it more difficult for bots.

 

 

 

 

 

 

 

 

 

About Author

Author Image
Swati Rahangdale

Swati has good konwledge of HTML,CSS, Boostrap.now . She is a UI developer. Her hobbies are watching movie.

Request for Proposal

Name is required

Comment is required

Sending message..