I have an issue. I want to store the ipv4 of a user in my database. For that I am using this external API called https://ipapi.co/json.
I am trying to implement the system. I have thought of a solution and it goes this way - On the website, as soon as a user visits a page, an ajax get request is made to that API which fetches the user's ip
and stores it in an input type= hidden
to which I can get access in req.body
and store in the database.
In order to avoid the user use chromedevtools to change that attribute I can add oncontextmenu="return false"
onkeydown="return false;"
onmousedown="return false;"
to the body so that user cannot get access to the chrome devtools.
I am not sure if this will work out. Can you guys please suggest.
Another doubt that I have is that is the ajax request is made by the user or by the server? If the server makes the request then IP will be of the server which is useless. Please help!