I'm trying to add a like button for users to engage with my posts without requiring them to log in. Right now, I'm using the hash of the user's IP address to track likes in my Cloudflare D1 database. However, given that most people's public IPs are dynamic, users can easily like a post multiple times if their IP changes. I'm looking for suggestions on more effective methods to prevent this. I'm thinking showing total likes on the post and sharing it on platforms like Reddit or Hacker News would be a good start, but I'm open to other creative solutions. One idea I had was requesting users' emails and sending them an OTP, but I worry that people might just use temporary email addresses or that it might be too much effort for them.
2 Answers
Identifying users without a login can be a challenge. You could consider using third-party like buttons, like Facebook's, but keep in mind that users will need to log into that service. It may not fit seamlessly with your own platform but could simplify the process for users who are already on those platforms.
Fingerprinting users is another approach, but it varies by device and browser. You might consider using cookies or local storage to keep track of whether a user has liked your content. If they try to like it again, you can check for the relevant data there.

Just keep in mind that any tracking method, including fingerprinting, requires informed consent due to GDPR regulations.