{"id":16634518,"url":"https://github.com/maliming/recaptcha","last_synced_at":"2025-05-16T18:11:07.921Z","repository":{"id":47780475,"uuid":"224196371","full_name":"maliming/reCAPTCHA","owner":"maliming","description":"reCAPTCHA for Asp Net Core 3.x \u0026 5.x \u0026 6.x \u0026 7.x \u0026 8.x \u0026 9.x","archived":false,"fork":false,"pushed_at":"2024-12-10T09:17:42.000Z","size":3280,"stargazers_count":64,"open_issues_count":0,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-12T17:46:51.348Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://developers.google.com/recaptcha/intro","language":"C#","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/maliming.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-26T13:16:00.000Z","updated_at":"2025-01-16T13:48:22.000Z","dependencies_parsed_at":"2025-01-01T10:00:40.235Z","dependency_job_id":"ae636859-c1b3-479c-8fff-40e4b98df779","html_url":"https://github.com/maliming/reCAPTCHA","commit_stats":{"total_commits":21,"total_committers":4,"mean_commits":5.25,"dds":"0.47619047619047616","last_synced_commit":"d44cd8e494dbffe1b5c169d8c373b3a3865ae845"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maliming%2FreCAPTCHA","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maliming%2FreCAPTCHA/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maliming%2FreCAPTCHA/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maliming%2FreCAPTCHA/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maliming","download_url":"https://codeload.github.com/maliming/reCAPTCHA/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254582907,"owners_count":22095518,"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":[],"created_at":"2024-10-12T05:39:11.208Z","updated_at":"2025-05-16T18:11:07.901Z","avatar_url":"https://github.com/maliming.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Owl.reCAPTCHA\nGoogle reCAPTCHA for ASP NET Core (v3 and v2)\n\n# Demo\n\nV3:\n\n![V3](gif/V3_Demo.gif)\n\nV3 Programmatically:\n\n![V3 Programmatically](gif/V3_Programmatically_Demo.gif)\n\nV2 Invisible:\n\n![V2_Invisible](gif/V2_Invisible.gif)\n\nV2 Checkbox:\n\n![V2_Checkbox](gif/V2_Checkbox.gif)\n\n\n# Install-Package\n\n```\nInstall-Package Owl.reCAPTCHA\n```\n\n# reCAPTCHA v3\n\n### v3 startup\n```\nservices.AddreCAPTCHAV3(x =\u003e\n{\n    x.SiteKey = \"your_site_key\";\n    x.SiteSecret = \"your_site_secret\";\n});\n```\n\n### v3 razor page\n\n```\n@addTagHelper *, Owl.reCAPTCHA\n\n\u003cform method=\"POST\"\u003e\n    \u003cinput id=\"token\" name=\"token\" type=\"text\" /\u003e\n    \u003cinput id=\"submit\" type=\"submit\" value=\"submit\" /\u003e\n\u003c/form\u003e\n\n\u003crecaptcha-script-v3 /\u003e\n\n@*\n    Hide-the-recaptcha-badge\n    https://developers.google.com/recaptcha/docs/faq#id-like-to-hide-the-recaptcha-badge.-what-is-allowed\n    \u003crecaptcha-script-v3 hide-badge=\"true\" /\u003e\n*@\n\n\u003cscript\u003e\n    function callback(token) {\n        document.getElementById(\"token\").value = token;\n    }\n\u003c/script\u003e\n\n\u003crecaptcha-script-v3-js action=\"login\" callback=\"callback\" /\u003e\n```\n\n```\n@addTagHelper *, Owl.reCAPTCHA\n\n\u003cform method=\"POST\" id=\"recaptchaForm\"\u003e\n    \u003cinput id=\"token\" name=\"token\" type=\"text\" /\u003e\n    \u003cinput id=\"submitBtn\" type=\"submit\" value=\"submit\" /\u003e\n\u003c/form\u003e\n\n\u003cscript\u003e\n    document.getElementById(\"submitBtn\").onclick = function(e) {\n        e.preventDefault();\n        grecaptcha.reExecute(function(token) {\n            document.getElementById(\"token\").value = token;\n            document.getElementById(\"recaptchaForm\").submit();\n        })\n    };\n\u003c/script\u003e\n\n\u003crecaptcha-script-v3 /\u003e\n\n@*\n    Hide-the-recaptcha-badge\n    https://developers.google.com/recaptcha/docs/faq#id-like-to-hide-the-recaptcha-badge.-what-is-allowed\n    \u003crecaptcha-script-v3 hide-badge=\"true\" /\u003e\n*@\n\n\u003crecaptcha-script-v3-js action=\"login\" execute=\"false\" /\u003e\n```\n\n### v3 razor page model\n\n```\npublic class V3Model : PageModel\n{\n\tprivate readonly IreCAPTCHASiteVerifyV3 _siteVerify;\n\n\tpublic V3Model(IreCAPTCHASiteVerifyV3 siteVerify)\n\t{\n\t\t_siteVerify = siteVerify;\n\t}\n\n\tpublic async Task OnPostAsync(string token)\n\t{\n\t\tvar response = await _siteVerify.Verify(new reCAPTCHASiteVerifyRequest\n\t\t{\n\t\t\tResponse = token,\n\t\t\tRemoteIp = HttpContext.Connection.RemoteIpAddress.ToString()\n\t\t});\n\n        /*\n        https://developers.google.com/recaptcha/docs/v3\n        response:\n        {\n            \"success\": true|false,      // whether this request was a valid reCAPTCHA token for your site\n            \"score\": number             // the score for this request (0.0 - 1.0)\n            \"action\": string            // the action name for this request (important to verify)\n            \"challenge_ts\": timestamp,  // timestamp of the challenge load (ISO format yyyy-MM-dd'T'HH:mm:ssZZ)\n            \"hostname\": string,         // the hostname of the site where the reCAPTCHA was solved\n            \"error-codes\": [...]        // optional\n        }\n        */\n\t}\n}\n```\n\n# reCAPTCHA v2\n\n### v2 startup\n```\nservices.AddreCAPTCHAV2(x =\u003e\n{\n    x.SiteKey = \"your_site_key\";\n    x.SiteSecret = \"your_site_secret\";\n});\n```\n\n### v2 razor page(checkbox mode)\n\n```\n@addTagHelper *, Owl.reCAPTCHA\n\n\u003crecaptcha-script-v2 /\u003e\n\n\u003cscript\u003e\n    function callback(token) {\n        document.getElementById(\"token\").value = token;\n    }\n\u003c/script\u003e\n\n\u003cform method=\"POST\"\u003e\n    \u003cinput id=\"token\" name=\"token\" type=\"text\" /\u003e\n    \u003cinput id=\"submit\" type=\"submit\" value=\"submit\" /\u003e\n\u003c/form\u003e\n\n\u003crecaptcha-div-v2 callback=\"callback\" /\u003e\n```\n\n### v2 razor page(invisible mode)\n\n```\n@addTagHelper *, Owl.reCAPTCHA\n\n\u003cscript\u003e\n    function onload() {\n        grecaptcha.execute();\n    }\n\n    function callback(token) {\n        document.getElementById(\"token\").value = token;\n    }\n\u003c/script\u003e\n\n\u003crecaptcha-script-v2 onload=\"onload\" /\u003e\n\n@*\n    Hide-the-recaptcha-badge\n    https://developers.google.com/recaptcha/docs/faq#id-like-to-hide-the-recaptcha-badge.-what-is-allowed\n    \u003crecaptcha-script-v2 hide-badge=\"true\" /\u003e\n*@\n\n\u003cform method=\"POST\"\u003e\n    \u003cinput id=\"token\" name=\"token\" type=\"text\" /\u003e\n    \u003cinput id=\"submit\" type=\"submit\" value=\"submit\" /\u003e\n\u003c/form\u003e\n\n\u003crecaptcha-div-v2 callback=\"callback\" size=\"invisible\" /\u003e\n```\n\n### v2 razor page(invisible mode)\n\n```\n@addTagHelper *, Owl.reCAPTCHA\n\n\u003cscript\u003e\n    function callback(token) {\n        document.getElementById(\"token\").value = token;\n        document.getElementById(\"demo-form\").submit();\n    }\n\u003c/script\u003e\n\n\u003crecaptcha-script-v2  /\u003e\n\n@*\n    Hide-the-recaptcha-badge\n    https://developers.google.com/recaptcha/docs/faq#id-like-to-hide-the-recaptcha-badge.-what-is-allowed\n    \u003crecaptcha-script-v2 hide-badge=\"true\" /\u003e\n*@\n\n\u003cform id=\"demo-form\" method=\"POST\"\u003e\n    \u003cinput id=\"token\" name=\"token\" type=\"text\" /\u003e\n    \u003cbutton recaptcha-v2-callback=\"callback\" recaptcha-v2-size=\"invisible\"\u003eSubmit\u003c/button\u003e\n\u003c/form\u003e\n```\n\n### v2 razor page model\n\n```\npublic class V2_CheckboxModel : PageModel\n{\n\tprivate readonly IreCAPTCHASiteVerifyV2 _siteVerify;\n\n\tpublic V2_CheckboxModel(IreCAPTCHASiteVerifyV2 siteVerify)\n\t{\n\t\t_siteVerify = siteVerify;\n\t}\n\n\tpublic async Task OnPostAsync(string token)\n\t{\n\t\tvar response = await _siteVerify.Verify(new reCAPTCHASiteVerifyRequest\n\t\t{\n\t\t\tResponse = token,\n\t\t\tRemoteIp = HttpContext.Connection.RemoteIpAddress.ToString()\n\t\t});\n\n        /*\n        https://developers.google.com/recaptcha/docs/verify\n        response:\n        {\n            \"success\": true|false,\n            \"challenge_ts\": timestamp,  // timestamp of the challenge load (ISO format yyyy-MM-dd'T'HH:mm:ssZZ)\n            \"hostname\": string,         // the hostname of the site where the reCAPTCHA was solved\n            \"error-codes\": [...]        // optional\n        }\n        */\n\t}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaliming%2Frecaptcha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaliming%2Frecaptcha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaliming%2Frecaptcha/lists"}