18.05.2016 Views

Mittwoch, 18. Mai, 2016

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

MongoDB CRUD the MVC way with Passport Authentication 64<br />

document inside a document¹²⁶ about which you can learn more on the respective links.<br />

User authentication with Passport<br />

registeringIdontAlways<br />

Passport¹²⁷ is a Node.js authentication middleware that authenticates requests sent to your Express<br />

application. It offers both local authentication (username/password) and OAuth authentication<br />

(Facebook, Twitter, Github, Google, … - full list here¹²⁸.) methods called strategies.<br />

In order to install Passport execute:<br />

1 $ npm install passport --save<br />

Now, add the following two lines in the server.js file:<br />

¹²⁶http://mongoosejs.com/docs/2.7.x/docs/populate.html<br />

¹²⁷http://passportjs.org/<br />

¹²⁸http://passportjs.org/guide/providers/

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!