Voting app question

I notice the Full stack voting app project will track who has voted for what.
I get how you can track how logged in users vote, but how do you track users who haven’t logged in have voted.
Do you have to log their IP address in the database?

The simple answer is that you simply don’t. When an unauthenticated user votes, you increment the vote count, but you don’t need to track who voted. IP addresses would be unreliable anyways. You could use a cookie, but that only works so long as the user doesn’t delete it.

2 Likes

I just noticed the sample app does not allow you to vote for the same question twice.

They may be used cookies, or some kind of tokens stored in localStorage. But both of them are easy to delete, change. So both of them are not 100% safe. A user still can cheat the system.


I think initially requirements were - only authenticated users can vote(watch Instruction video). But I don’t understand why they changed it - now unauthenticated users can vote too…

1 Like