Question

I need to generate a token once my users have authenticate with a 3rd party(Facebook, or Twitter). I will give this token back to the client and they will be able to access all the users information using it.

I need the token to be hard to guess and hard to predict. (Hard meaning it would take a day or two to guess with a modern desktop)


MySQL has the function UUID() that generates a value that is unique but the documentation also says its not unguessable or unpredictable. I'm not sure if that means it's not hard to guess or predict.

Était-ce utile?

La solution

There are tons of node.js modules, that do exactly what you need. Popular picks:

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top