Google reCAPTCHA: Basic example to integrate Google reCAPTCHA in Play Application with the help of play-recaptcha module

Playing with Google reCAPTCHA

Basic example to integrate Google reCAPTCHA in Play Application with the help of play-recaptcha module

Play reCAPTCHA Module

This is a Play Framework module, for Scala and Play 2.x, to provide integration with Google reCAPTCHA (version 1 or 2) in a reactive (non-blocking) manner.

google-recaptcha-example-v1 google-recaptcha-example-v2

  • Used Play reCAPTCHA module to integrate Google reCAPTCHA API
  • Embedded JS & CSS libraries with WebJars.
  • Integrating with a CSS framework (Twitter Bootstrap)
  • Bootswatch-Darkly with Twitter Bootstrap to improve the look and feel of the application

Registration Form Screen

google_recaptcha_form

Result Screen

google_rechptcha_result

Dependency


The play-recaptcha module is distributed using Maven Central so it can be easily added as a library dependency in your Play Application’s SBT build scripts, as follows:

"com.nappin" %% "play-recaptcha" % "1.0"

Configuration


The play-recaptcha module supports the following basic configuration settings in your application.conf file:

recaptcha.apiVersion=2
recaptcha.privateKey=<YOUR Google reCAPTCHA privateKey>
recaptcha.publicKey=<YOUR Google reCAPTCHA publicKey>
#recpatcha.requestTimeout=10 seconds
recaptcha.theme=light
recaptcha.type=image

for more info check here


Build Instructions


  • To run the Play Framework, you need JDK 6 or later
  • Install Typesafe Activator if you do not have it already. You can get it from here
  • Execute ./activator clean compile to build the product
  • Execute ./activator run to execute the product
  • playing-google-recaptcha should now be accessible at localhost:9000

References


4 thoughts on “Google reCAPTCHA: Basic example to integrate Google reCAPTCHA in Play Application with the help of play-recaptcha module

Leave a Reply

%d bloggers like this: