NPM version Build Status Coverage Status

POP3 authentication strategy for Passport

This module lets you authenticate using POP3 authentication in your Node.js applications. By plugging into Passport, POP3 authentication can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express.


$ npm install --save passport-pop3


Configure Strategy

The POP3 authentication strategy authenticates users using a username and password, and you must provide host and port for POP3 authentication.

passport.use(new POP3Strategy({
    host: 'localhost',
    port: 995
Available Options

The available options are:

  • enabletls - Optional, defaults to true. If enabletls is true, the library will use a TLS connection. Note that you will have to set the correct port (generally 995).
  • tlserrs - Optional, defaults to false. If tlserrs is true, then TLS errors will be ignored.
  • debug - Optional, defaults to false. If debug is true, prints out requests and responses.
  • usernameField - Optional, defaults to 'username'.
  • passwordField - Optional, defaults to 'password'.

The fields usernameField and passwordField define the name of the properties in the POST body that are sent to the server.


By default, POP3Strategy expects to find credentials in parameters named username and password. If your site prefers to name these fields differently, options are available to change the defaults.

passport.use(new POP3Strategy({
    host: 'localhost',
    port: 110,
    enabletls: false,
    usernameField: 'email',
    passwordField: 'passwd',

Authenticate Requests

Use passport.authenticate(), specifying the 'pop3' strategy, to authenticate requests.

For example, as route middleware in an Express application:'/login',
  passport.authenticate('pop3', { failureRedirect: '/login' }),
  function(req, res) {


MIT © Chun-Kai Wang