I am working on Angular 5 and I am new to this. My requirement is to fetch the IP address of the end-user. I want to store the IP address of those users whose score is less than 0.5 (that is likely to be bot) so that I can blacklist the IP of low scorer users.
When I verifying the site recaptcha I am receiving json containing:
{
"action": "login",
"challenge_ts": "2020-11-24T06:48:33Z",
"hostname": "localhost",
"score": 0.9
}
Please let me know how can I fetch the IP of that user also. Any help will be appreciated.
Recaptcha probably doesn't provide the user's IP. But there's a way to verify the token server side. Read it more here: "Verifying the user's response" https://developers.google.com/recaptcha/docs/verify. You could use this to blacklist the IP address of the "bot":
On the frontend:
On the Backend:
https://www.google.com/recaptcha/api/siteverify
with the data collected in first step. Check the POST body format from the docs (link mentioned above)Note that this process is to be performed within two minutes after the recaptcha token is generated. So you can directly send a request to your backend as soon as the token is generated instead of waiting till the user clicks the submit button.
This is one way how you can blacklist the "bot's" IP.