{"id":21490310,"url":"https://github.com/rvelhote/go-recaptcha","last_synced_at":"2025-06-24T13:10:31.481Z","repository":{"id":57492102,"uuid":"80864449","full_name":"rvelhote/go-recaptcha","owner":"rvelhote","description":"Go (Golang) package to verify Google reCAPTCHA challenge responses.","archived":false,"fork":false,"pushed_at":"2018-08-16T08:39:54.000Z","size":23,"stargazers_count":0,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-16T14:15:31.991Z","etag":null,"topics":["codeclimate","go","golang","golang-package","recaptcha","recaptcha-api","travis-ci"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rvelhote.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-03T19:58:51.000Z","updated_at":"2017-02-05T19:37:28.000Z","dependencies_parsed_at":"2022-08-28T11:50:34.543Z","dependency_job_id":null,"html_url":"https://github.com/rvelhote/go-recaptcha","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/rvelhote/go-recaptcha","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvelhote%2Fgo-recaptcha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvelhote%2Fgo-recaptcha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvelhote%2Fgo-recaptcha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvelhote%2Fgo-recaptcha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rvelhote","download_url":"https://codeload.github.com/rvelhote/go-recaptcha/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvelhote%2Fgo-recaptcha/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261682948,"owners_count":23193681,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codeclimate","go","golang","golang-package","recaptcha","recaptcha-api","travis-ci"],"created_at":"2024-11-23T14:34:07.833Z","updated_at":"2025-06-24T13:10:31.444Z","avatar_url":"https://github.com/rvelhote.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![](https://godoc.org/github.com/rvelhote/go-recaptcha?status.svg)](https://godoc.org/github.com/rvelhote/go-recaptcha) [![Build Status](https://travis-ci.org/rvelhote/go-recaptcha.svg?branch=master)](https://travis-ci.org/rvelhote/go-recaptcha) [![Code Climate](https://codeclimate.com/github/rvelhote/go-recaptcha/badges/gpa.svg)](https://codeclimate.com/github/rvelhote/go-recaptcha) [![Issue Count](https://codeclimate.com/github/rvelhote/go-recaptcha/badges/issue_count.svg)](https://codeclimate.com/github/rvelhote/go-recaptcha)\n\n# reCAPTCHA Verification Package\nThis is a Go package that allows you to verify user response of reCAPTCHA challenged against the verification API. There are already a [few](https://github.com/HiFX/go-recaptcha) [packages](https://github.com/haisum/recaptcha) [available](https://github.com/dpapathanasiou/go-recaptcha) that you can use as alternatives. This package was specifically implemented as a learning experience as well as to be used in [another one of my projects](https://github.com/rvelhote/dnspropagation).\n\nThe package is only meant to help you with verifying the user's response with the API. It will not handle the form submission for you. That is up to you to deal with.\n\nIf you never used reCAPTCHA and want to know how to set it up in your project I recommend that you visit the [official documentation](https://developers.google.com/recaptcha/intro).\n\n## Installation\nInstall this package as you would with any Go package by using `go get`.\n\n```\ngo get github.com/rvelhote/go-recaptcha\n```\n\n## Usage\nAs mentioned in the beginning, this package only facilitates that interaction with the API; it will not handle the form submission itself.\n\nHere is an example of how to use this package in a web application. Please note that the private key being used is a test key as defined by the [documentation FAQ](https://developers.google.com/recaptcha/docs/faq).\n\n```\nfunc verify(w http.ResponseWriter, req *http.Request) {\n\treq.ParseForm()\n\t\n\tchallenge := req.PostFormValue(\"g-recaptcha-response\")\n\tip, _, _ := net.SplitHostPort(req.RemoteAddr)\n\n\tinstance := recaptcha.Recaptcha{ PrivateKey: \"6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe\" }\n\tresponse, err := instance.Verify(challenge, ip)\n\n\tlog.Println(response.Success)\n\tlog.Println(response.Challenge)\n\tlog.Println(response.Hostname)\n\tlog.Println(response.ErrorCodes)\n\tlog.Println(err)\n}\n```\n\nThe `Verify` function that is part of the package will return a `boolean` with the end-result and a list of errors, if any, that might have occurred during the processing.\n\n## Remote IP\nIn the example before I simply used the `RemoteAddr` from the request object. I believe it's not within the scope of this package to handle that so be advised that this is not the most complete/best way to get an IP Address if your application is behind a proxy or a load balancer. For a more complete verification you should also check `X-Forwarded-For` and/or `X-Real-IP`. There is also a `Forwarded` HTTP header specified in [RFC-7239](https://tools.ietf.org/html/rfc7239) however I'm not sure if it's widely used.\n\n## Contributing\nContributions, suggestions and requests are welcome via Issue Tracker and via Pull Requests. I will do my best to reply and discuss.\n\nThank you!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frvelhote%2Fgo-recaptcha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frvelhote%2Fgo-recaptcha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frvelhote%2Fgo-recaptcha/lists"}