reCAPTCHA ERROR: Invalid domain for site key - html

I have implemented my reCAPTCHA in line with as is shown in the example.
I have this script in the head tag:
<script src="https://www.google.com/recaptcha/api.js"></script>
In my form in HTML I have:
<div class="g-recaptcha" data-sitekey="my public sitekey here"></div>
But when I load the form I get this error:
ERROR: Invalid domain for site key
I have confirmed that this is the correct site key for my domain.
The code is currently in a subdomain so I thought maybe that was the problem so I also added the subdomain to the Google reCAPTCHA admin but still get the error.
The exact same code works 100% in a different domain (with a key specific to that domain).
What could be the problem?

In case someone has a similar issue. My resolution was to delete the key that was not working and got a new key for my domain. And this now works with all my sub-domains as well without having to explicitly specify them in the recaptcha admin area.

First of all, the keys are managed at https://www.google.com/recaptcha/admin#list
I ran into this error because I'm using the same key on a few different domains and I had forgotten to add one of the domains to the key.
After adding my site it took a minute or two (most likely because of cache) for things to work normally again.

I had the same problems I solved it.
I went to https://www.google.com/recaptcha/admin and clicked on the domain and then went to key settings at the bottom.
There I disabled the the option below
Domain Name Validation
Verify the origin of reCAPTCHA solution
clicked on save and captcha started working.
I think this has to do with way the server is setup. I am on a shared hosting and just was transferred without notice from Liquidweb to Deluxehosting(as the former sold their share hosting to the latter) and have been having such problems with many issues.
I think in this case google is checking the server but it is identifying as shared server name and not my domain.
When i uncheck the "verify origin" it starts working.
Hope this helps solve the problem for the time being.

No need to create a new key just clear site data on browser
If you change your site domain then add that domain to existing key (it's not necessary to a create new one) and save it.
https://www.google.com/recaptcha/admin#list
but google recapture has some data on browser. Clear them then it will work with your new domain

I guess the quickest way is just to disable the domain check while you're developing it

I was using localhost during unit testing when my recaptcha key was registered to 127.0.0.1. So I changed my browser to point to 127.0.0.1 and it started working. Although I was able to add "localhost" to the list of domains in my ReCaptcha Key Settings, I am still unable to unit test using localhost. I have to use the loopback IP address 127.0.0.1.

You may have inadvertently used a private key for a public key.

There is another point must be noted before regenerating keys that resolve 90% issue.
for example your xampp directory is C:\xampp
and htdocs folder is C:\xampp\htdocs
we want to open page called: example-cap.html
and page is showing error:
invalid domain for site key
Use your localhost address in browser address like:
localhost/example-cap.html
this will resolve your issue
Do not use address c:\xampp\htdocs\example-cap.html
this will generate error

Make sure you fill in your domain name and it must not end with a path.
example
http://yourdomain.com (good)
http://yourdomain.com/folder (error)

I ran into this issue also and my solution was to verify I was integrating the appropriate client code for the version I had selected.
In my case, I had selected reCAPTCHA v3 but was taking client integration code for v2.
V3 looks like this:
<script src="https://www.google.com/recaptcha/api.js?render=reCAPTCHA_site_key"></script>
<script>
grecaptcha.ready(function() {
grecaptcha.execute('reCAPTCHA_site_key', {action: 'homepage'}).then(function(token) {
...
});
});
</script>
V2 code looks like this:
<html>
<head>
<title>reCAPTCHA demo: Simple page</title>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
</head>
<body>
<form action="?" method="POST">
<div class="g-recaptcha" data-sitekey="your_site_key"></div>
<br/>
<input type="submit" value="Submit">
</form>
</body>
</html>
As for which version you have, this will be what you decided at the start of your reCAPTCHA account setup.

Try to add domains without http:// and https:// e.g. example.com

For me, I had simply forgotten to enter the actual domain name in the "Key Settings" area where it says Domains (one per line).

I had the same problems. I solved it: I went to https://www.google.com/recaptcha/admin, clicked on the domain and then went to key settings at the bottom.
There I disabled the option below Domain Name Validation Verify the origin of reCAPTCHA solution.
Clicked on save and captcha started working.

You should set your domain for example: www.abi.wapka.mobi, that is if you are using a wapka site.
Note that if you had a domain with wapka it won't work, so compare wapka with your site provider and text it.

I tried for almost 4 Hours with this and finally figuring it out with guidance from here, I thought I would share my solution with you.
Ok so my domain is an addon domain. I also got "ERROR for site owner: Invalid domain for site key" I had checked that everything was correct almost a thousand times and it looked right to me, until I thought of it in terms of a desktop shortcut.
Solution:
So for an addon domain make sure that the parent url is also in the list of domains i.e:
[ADDON DOMAIN].[PARENT DOMAIN].com .
The addon location will be the folder that you set on your host so when using addon domains ensure to name the root with something logical.
Hope this helps someone else and thanks for the suggestions people.

My domain was quite complex. I took the value returned by window.location.host in the developer console and pasted that value in the recaptcha admin white list. Then I cleared the cache and reloaded the page.

I had a similar problem due to the fact that I forgot to show the render parameter
<script src='https://www.google.com/recaptcha/api.js?render=SITE_KEY' async defer></script>

Related

GitHub Pages site works on mobile but not desktop?

My github pages site with a custom domain works just fine on mobile but when i try to access the same URL from desktop i get a DNS_PROBE_FINISHED_NXDOMAIN error. Any ideas why this may be ? The site can be found here if it helps Site
EDIt: it works with this link which does not include 'www.' if this makes my problem any clearer
I doubt that it shows on your mobile, DNS records doesn't return anything WhatsMyDNS
Are you certain that you've got your DNS server up correctly.? I did a lookup for your domain name and it doesn't appear that you've got your CNAME pointing to GitHub pages. To do so, add a CNAME record to your domain via your domain registrar's dashboard. This should point to the name of your GitHub pages url (ex. john.github.io/xyz). You can read up on this more here.
I notice you say that it doesnt work if you add the www.. I'm not exactly sure why this is (there's not enough information to say why). I'm guessing you did not correctly set up the record, so here's what it should look like:
# A 4H 127.0.0.1
(You may change the TTL and IP, of course)
I'm guessing you forgot the # in the first field, which puts it under both www and the root subdomain. If this is not the case, you can attempt to fix this issue by adding www in a separate record to easily resolve the problem.
www A 4H 127.0.0.1
Note that this will work for both CNAME and A records.
Maybe desktop dns server is not so fast to fetch changes.
Change dns server in desktop connection settings for a public google's 8.8.8.8. For windows that's going to be Control Panel > Network and sharing center > Change adapter settings > Right click adapter (in my case it was WIFI) > Choose connection (Internet protocol Version 4) > Click Properties > Select "Use the following DNS server addresses" > Enter 8.8.8.8 in "Preferred DNS server" > Click OK
I am a newbie in the field and faced the same issue. Came here to find the solution. I just did plug out the ethernet and connected my laptop to my wifi and it worked.

Attackers might be trying to steal your information from (for example, passwords, messages, or credit cards). NET::ERR_CERT_COMMON_NAME_INVALID

I'm getting the following error for one specific website (and only one specific website):
I've tried the following:
Making sure my time / data settings are correct
Clearing all browsing data
Deleting and reinstalling Chrome
Nothing works. Interestingly, I only get this error for one specific site (www.datacamp.com). And when I turn off wi-fi and tether my iPhone, I'm able to get through to the site. When I turn my wi-fi back on, I get errors again.
When I view details I see this:
And when I view the certificate I see this:
I've tried deleting the certificate, but I get the following message:
Any help is greatly appreciated!
If you are getting this error when access localhost, simply go to
chrome://flags/
and enable Allow invalid certificates for resources loaded from localhost.
Ok, I don't know why it took me so long to try this. I just unplugged my modem and router, then plugged them back in. At least for now, it seems to have resolved the issue...
Check your connection's DNS entries. It's likely a adware or malware program modified them.
open network and sharing center
On the left side- click on:
change advanced sharing settings.
click on home or work.
go through and check "turn off" for the first three questions.
turn on password.
Your computer connection was wide open!!!!
Flushing DNS worked for me in Windows 10. Simply open powershell and issue this command:
ipconfig /flushdns
Adding Google DNS 8.8.8.8 and the Cloudflare DNS 1.1.1.1 solved my issue.
If you are facing this while visiting a website, you can follow below.
This might not solve the issue always. But, this is how I solve it around 8/10 times.
To Resolve this on Chrome :
[Approach 1]
Just Click on Proceed to www.xyzxyz.com..(unsafe)
[Approach 2]
Go to : chrome://net-internals/#hsts
Suppose the site for which the error shown is : https://twitter.com/xxx/yyy....
In the "Delete Domain" option, Enter domain as "twitter.com".
Press Delete.
Reload the page you were trying to visit.

chrome wont let me access localhost (it google searches instead)

How can I disable chrome using address bar for google search?
I cant access localhost at 0.0.0.0:6000, because chrome thinks it's a google search and not an url
any ideas?
This may be because a url was added to your search history. Google is doing you a favor because that's what you did once before somehow.
Try clearing your history to see if this is the case.
I went to "Clear Browsing Data" in Settings > Advanced and I was able to enter a localhost url again.
Be sure you end the url with "/" symbol.
Try:
http://0.0.0.0:6000/
Instead of:
0.0.0.0:6000
SOLUTION For chrome version 62:
settings > advanced > Use a web service to help resolve navigation errors > OFF
Try
- turn off Search Suggestions
- under LAN settings, uncheck "use automatic configuration"
Do you get the same behavior with an incognito window?
Try this alternative: http://127.1.1.1:6000 or 127.1.1.1:6000 (without http).
A search through the web has revealed several different possible causes to this problem as well as solutions.
Causes:
this is malware
this is a chrome/browser issue
this is a misconfiguration of the httpd service
Solutions:
scan for malware, though probably not the issue.
update the host file, so that localhost points to 127.0.0.1
confirm your httpd service is accepting http:// requests through port 80, 8080, or some other port.
make sure the URL has the correct port .. http://localhost:8080
try appending different delimiting characters [ / ? # ] to the URL ...
localhost/Dir/
localhost/Dir?p=x
localhost/Dir#123
does it happen on a specific directory?
localhost/Dir .. works
localhost/Dir2 .. goes to search.
This suggests that the httpd service's configuration may need to be fixed. or that an .htaccess file is the cause. If these problems can be ruled out, then it's a browser issue.
remove the autocomplete entry from the browsers search/address bar
in most cases, type the url, using the arrow keys - highlight the offending entry, press [DELETE] or [SHIFT}+[DELETE].
does your browser support turning off autocomplete or searching from the address bar?
.. chrome .. Disable Predictive Text
.. firefox .. Disable Predictive Text
open the CLI and issue [ >wget localhost/dir ]. Observe what is returned on a working vs non working directory.
Follow up:
This issue is especially annoying when working with .htaccess files and browser redirect statements in PHP, ASP, nodeJS, and JSP which redirect the browser to a specific URL, but instead takes the user to a search page. If at all possible pre-pend http:// and post-pend a slash (/) after the URL in redirects.
http://localhost/dir/
And, YES ... it is annoying to have to add extra characters (as a work around) to get URLs to work right.
I might be a bit late to the party here but I just encountered this same problem on the current chrome (v. 96.0.4664.93) and could it would not resolve any local address using any of the other methods that I found on the web(http://192.168.178.1 or setting flags or insecure DNS).
What solved the problem, was a simple "/" at the beginning of the query string.
Whenever I enter
/192.168.178.1
into the Omnibox and hit enter it works for all services.
If some other people could verify this - I'd be really happy to get some feedback on this approach.
I have this problem often myself. First, go to just localhost, chrome should understand that, then, when you type in localhost/my/url/here, the context will allow chrome to understand to treat it as a url.

ChromeCast: Chrome sample project not running

I am following the setup instructions here: https://github.com/googlecast/CastHelloText-chrome step by step.
I have my Google Drive hosting folder here: https://drive.google.com/folderview?id=0ByI6ac75SrewSE1odEdBMm1fNk0&usp=sharing
I set my URL (for my application in the developer console) to https://googledrive.com/host/0ByI6ac75SrewSE1odEdBMm1fNk0/receiver.html
However, when I run my chromehellotext: https://googledrive.com/host/0ByI6ac75SrewSE1odEdBMm1fNk0/chromehellotext.html
I get this error in the console: "onError: {"code":"session_error","description":"NOT_FOUND","details":null}" and my Chromecast will not connect when I hit the carriage return and select my Chromecast.
What am I doing wrong?
Checking the box for sending the serial number to google solved this problem for me as well. It took me a few minutes to figure out where this box is so that I could check it. I had to download the chromecast setup application and then let it discover my device, select it, and click settings. The checkbox is in the settings.
It can take up to 6 hours to publish your receiver app. As the docs suggest, all you need to do is restart your Chromecast to force the device to reload it's configuration data. I was having this same issue and a restart was all I needed.
Make sure your receiver app is loading the cast_receiver.js javascript file as well as starting an instance of the castReceiverManager.
I was seeing that same timeout message before I did that. My initial receiver code was just static HTML, but apparently that's not good enough.
The following, in my receiver's index.html did the trick for me:
<script src="//www.gstatic.com/cast/sdk/libs/receiver/2.0.0/cast_receiver.js"></script>
<script>
window.castReceiverManager = cast.receiver.CastReceiverManager.getInstance();
window.castReceiverManager.start();
</script>
(copied from https://developers.google.com/cast/docs/custom_receiver)

Exchange Server 2007 is altering href value

I am creating an email going out to internal users with the following code that has a link to an internal directory:
\\abc\123
And for whatever reason, the mail that comes in shows:
\\abc\123 and the link points to /abc/123
I am suspecting Exchange Server of somehow altering the mail message to make it less "dangerous", but I am really stuck here since this is a network address, going to internal users! When they click the link it doesn't show the directory.
Any help would be much appreciated!
Ok, finally figured this one out.
Exchange takes a lot of liberty when it re-renders the HTML and assumes that you want to put a relative web link versus network path.
That's why all the "\" were converted to "/".
The way around this is to add "file:///" prior to the href address:
\\abc\123
will work!