gorecaptcha icon indicating copy to clipboard operation
gorecaptcha copied to clipboard

A package for verifying Google reCaptcha v3 responses in Go

go-recaptcha

About

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

Usage

Install the package in your environment:

go get github.com/hazcod/go-recaptcha

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

recaptcha := Recaptcha{ PrivateKey: "your-recaptcha-private-key" }

Now call recaptcha.Verify(remoteip net.IP, action string, response string, minScore uint) which will return (success bool, err error).

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.