Creates an instance of the Auth class.
The options to use. Defaults to an in memory session store. You should use a real session store in production, because in memory stores will not scale across processes and log everybody out when the server restarts.
Private
authsPrivate
optionsRegister an authentication method.
The name of the authentication method.
The authentication method.
Middleware to sign in a user.
app.post("/signin", express.urlencoded({ extended: false }), authentication.authenticate("local"));
The authenticator to use. Has to be registered using addAuth.
Whether you want to handle the response yourself. Otherwise this function will send JSON back.
app.use this.
// cookie parser is needed and needs to be before you .use this
app.use(cookieParser());
app.use(auth.middleware())
https://www.npmjs.com/package/cookie-parser needs to be used before this is used.
Generated using TypeDoc
The main class that handles sessions and authentication. Each application should have one of these.
Example