Create a unique UserToken for a browser to track user without login in Nextjs 13
Unanswered
Cape lion posted this in #help-forum
Cape lionOP
I am trying to build a game very similar to https://www.moviegrid.io/, This Game generates some clues on the basis of the user guessing movies when the user guesses the first movie or tries to guess doesn't matter if the guess is true or false a unique token is generated to keep its session as this keep hold the clues for a days and refresh clues at specific time, so let us suppose i guessed a movie and its not true so my guess tried decrease from 9 to 8 now if i refersh the page or open game in new tab or close browser and open game i see that my guesses record are available and there is unique token that is used to get my record from database , I figured out all the logic just want to know how can i keep track of user as he never logged in , as this is something i never done before is it possible to create token that identify the browser or device i have no clue about this
2 Replies
@Cape lion I am trying to build a game very similar to https://www.moviegrid.io/, This Game generates some clues on the basis of the user guessing movies when the user guesses the first movie or tries to guess doesn't matter if the guess is true or false a unique token is generated to keep its session as this keep hold the clues for a days and refresh clues at specific time, so let us suppose i guessed a movie and its not true so my guess tried decrease from 9 to 8 now if i refersh the page or open game in new tab or close browser and open game i see that my guesses record are available and there is unique token that is used to get my record from database , I figured out all the logic just want to know how can i keep track of user as he never logged in , as this is something i never done before is it possible to create token that identify the browser or device i have no clue about this
Asian black bear
It is much easier than authentication. Your API endpoint can simply return a UUID when a user record is created and take one to find a user. Leave the uuid in cookies or local storage.
Because of the high randomness malicious people can not guess another players uuid, so it is secure