Thursday, March 30, 2017

passportjs, nodejs auth

The document of passportjs is not good. I followed the document and it did not make my code work.
After reading a couple of tutorial online, I eventually made it work.
I abstracted all passport related setting in one file, auth.js.

Here is the change in the server.js, basically it is adding authentication to the URL you want to protect.

Here are some helpful online tutorial
https://www.danielgynn.com/node-auth-part2/
https://blog.risingstack.com/node-hero-node-js-authentication-passport-js/
http://passportjs.org/docs/facebook
https://github.com/jaredhanson/passport-facebook#re-authentication


No comments:

Post a Comment