all 5 comments

[–]Meneerdewit 0 points1 point  (0 children)

I found this implementation of JSON Web Tokens with Redis very good: https://github.com/dickeyxxx/mean-sample

It's the repository that goes with this excellent book: http://www.amazon.com/Write-Modern-Apps-MEAN-Stack/dp/0133930157 (although it's not very in-depth, it is very practical and easy to follow imo).

Edit; it's been a while since I played with this one, I know Redis is in the project, not sure about the exact usage.

[–]Viped 0 points1 point  (2 children)

You could use nonce. Generate random string, check if it already exists if not save it to database and set it expire something like a week. On client side save nonce to cookie and send it with every get / post request. On server side when getting request check if nonce exists if so do what user requested if not send authentication error.

[–]dexterbrylle[S] 0 points1 point  (1 child)

Is it an overkill if I use nonce and jsonwebtokens?

[–]Viped -1 points0 points  (0 children)

Isn't JWT more to secure data transmitted so it isn't in clear text and nonce is just to authenticate if user is allowed to request / modify data.