A package for handling reCaptcha (http://www.google.com/recaptcha) form submissions in Go (http://golang.org/).
Switch branches/tags
Nothing to show
Clone or download
Latest commit 0e9736b Mar 31, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
example README updates Mar 30, 2018
.gitignore Updated the example for v2 and also added '.gitignore' to this repo Jun 5, 2016
LICENSE Updated license years Jun 5, 2016
README.md README updates Mar 30, 2018
recaptcha.go Applied gofmt Mar 30, 2018




This package handles reCaptcha (API version 2.0) form submissions in Go.


Install the package in your environment:

go get github.com/dpapathanasiou/go-recaptcha

To use it within your own code, import github.com/dpapathanasiou/go-recaptcha and call:

recaptcha.Init (recaptchaPrivateKey)

once, to set the reCaptcha private key for your domain, then:

recaptcha.Confirm (clientIpAddress, recaptchaResponse)

for each reCaptcha form input you need to check, using the values obtained by reading the form's POST parameters (the recaptchaResponse in the above corresponds to the value of g-recaptcha-response sent by the reCaptcha server.)

The recaptcha.Confirm() function returns either true (i.e., the captcha was completed correctly) or false, along with any errors (from the HTTP io read or the attempt to unmarshal the JSON reply).

Usage Example

Included with this repo is example.go, a simple HTTP server which creates the reCaptcha form and tests the input.

See the instructions for running the example for more details.


If you find this work useful, please consider making a donation:

Bitcoin Donate 14TM4ADKJbaGEi8Qr8dh4KfPBQmjTshkZ2

QR code