Alex Justi
Alex Justi

Reputation: 167

ASP.Net - Generating Secure Tokens

I am working on an authentication library for my website, and I want to use a token based authentication system, but I don't have a clue how to generate a secure session token so that I could identify users. Does anyone have any resources that would point me in the right direction?

Upvotes: 0

Views: 909

Answers (1)

achedeuzot
achedeuzot

Reputation: 4384

A random authentication token could be enough depending on the kind of architecture you have.

Or you could use GUIDs, ... There are a lot of possibilities, here is one:

When the user authenticates, generate a random token, add it into a cookie on the user system and into the database. When the user comes back, the unique random token is searched in the database so you can establish the link between the random token and the user. Tada !

Upvotes: 1

Related Questions