I'm trying to create a way for users to like my posts without needing to log in. Right now, I'm using the hash of the user's IP address stored in a Cloudflare D1 database. However, since many people's public IPs are dynamic, they could easily like the post multiple times when their IP changes. I'm curious about other methods I could explore. I thought about just displaying the number of likes on the post itself when I share it on platforms like Reddit or Hacker News, but I'd love to hear if there's a sleeker solution. One idea I had was to ask for an email address and send a one-time password (OTP), but that seems unrealistic since people could use temporary emails and most won't bother going through that hassle.
5 Answers
Honestly, without user login, it’s pretty tough to reliably identify users. You might consider using third-party options like the Facebook like button, but keep in mind that users will still need to be logged into those services to use it. It’s a potential workaround, but has its own limitations.
If you want to avoid the complexities of user tracking, just counting the hash of the IP along with some user agent details might be a decent, low-effort approach. Keep it simple, especially since you don't need a bulletproof solution.
Combining a cookie or local storage variable with an IP hash and other browser fingerprinting could work to identify users with reasonable accuracy. Just remember, it won’t be as reliable as having actual logins, but for your needs, it might be acceptable.
You seem to be approaching this like an engineer! If you're aiming for a login-less solution, consider using device fingerprinting along with local storage. It won't be perfect, but it offers some level of user engagement without the hassle of identity checks.
You could implement user fingerprinting as a method, but this varies by device and browser. Another option is to save the liked content ID in cookies or local storage and check that on return visits. While it's not foolproof, it could help manage likes without a login system if you combine it with IP hashes.

Related Questions
How to Build a Custom GPT Journalist That Posts Directly to WordPress
Cloudflare Origin SSL Certificate Setup Guide
How To Effectively Monetize A Site With Ads