Domanda

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.

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top