Gathering detailed insights and metrics for authentication-flows-js
Gathering detailed insights and metrics for authentication-flows-js
Gathering detailed insights and metrics for authentication-flows-js
Gathering detailed insights and metrics for authentication-flows-js
authentication-flows-js-elasticsearch
elasticsearch implementation for authentication-flows-js
authentication-flows-js-gae-datastore
Google AppEngine Datastore implementation for authentication-flows-js
authentication-flows-js-inmem
in-mem implementation for authentication-flows-js
@passageidentity/passage-flex-js
Passkey Flex for Web - Add native passkey authentication to your own client-side JavaScript authentication flows with Passage by 1Password.
authentication-flows-js is a powerful and highly customizable framework that covers all flows that any express-based authentication-server needs.
npm install authentication-flows-js
Typescript
Module System
Node Version
NPM Version
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
14 Stars
399 Commits
2 Forks
2 Watchers
5 Branches
1 Contributors
Updated on Jun 24, 2025
Latest Version
1.12.3
Package Id
authentication-flows-js@1.12.3
Unpacked Size
380.34 kB
Size
193.47 kB
File Count
86
NPM Version
9.8.1
Node Version
18.18.2
Published on
Aug 14, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
4
authentication-flows for javascript
Every secured web application should support these flows - unless it delegates the authentication to a third party (such as oAuth2.0). Thus, we end up in the same code written again and again.
The authentication-flows-js
module implements all authentication flows:
authentication-flows-js
is a package that any express-based secured web applications can reuse, to get all the flows
implemented, with a minimal set of configurations.
This way developers can concentrate on developing the core of their app, instead of messing around with flows that are
definitely not the core of their business.
I have prepared a sample application that uses authentication-flows-js
so it is a great place to start. Below there are
the required configurations needed.
According to the design:
The client-app chooses which repository it works with, and passes the appropriate adapters:
const app = express();
var authFlows = require('authentication-flows-js');
const authFlowsES = require('authentication-flows-js-elasticsearch');
const esRepo = new authFlowsES.AuthenticationAccountElasticsearchRepository();
authFlows.config({
user_app: app,
authenticationAccountRepository: repo,
redirectAfterLogin,
sendActivationEmailUponActivation [optional, see below]
});
currently, the following repositories are supported:
This module reuses that client-app' express server and adds several endpoints to it (e.g. /createAccount
).
Thus, the client-app should pass authentication-flows-js its server object (example above).
authentication-flows-js comes with a default set of configuration for the password policy (in
/config/authentication-policy-repository-config.json
). The hosting application can replace\edit the JSON file, and use
its own preferred values.
The password policy contains the following properties (with the following default values):
passwordMinLength: 6,
passwordMaxLength: 10,
passwordMinUpCaseChars: 1,
passwordMinLoCaseChars: 1,
passwordMinNumbericDigits: 1,
passwordMinSpecialSymbols: 1,
passwordBlackList: ["password", "123456"],
maxPasswordEntryAttempts: 5,
passwordLifeInDays: 60
an example for a client-app can be found here.
body-parser
According to https://www.digitalocean.com/community/tutorials/use-expressjs-to-get-url-and-post-parameters, the client-app
MUST use body-parser in order to be able to parse the body params.
Thus, the authentication-flows-js
can use:
debug(`createAccount requestBody ${req.body}`);
express
- this module uses web-api for flows such create-account, forget-password, etc.@log4js-node/log4js-api
- rather than being dependent on a specific version oflog4js
(to avoid headache for this library users).nodemailer
- sending verification emails. version 4.7.0 and NOT latest: https://stackoverflow.com/questions/54385031/nodemailer-fails-with-connection-refused-using-known-good-smtp-server/54537119#54537119DEBUG=*,-follow-redirects -express:* -body-parser:*
emailSender
smtpServer
smtpPort
emailServerUser
emailServerPass
ts-node test\mail\mail.test.ts
note: set the environment variables.
npm run build
npm version patch
npm publish
This module sends verification emails. By default, it uses nodemailer
and SMTP2GO,
but it makes sense that each application has its own mailing system. In addition, verification emails
may have the same look and feel of the hosting application. Hosing-application can have their own implementation by implementing MailSender
interface.
The AFM supports the below APIs:
This URL renders the login page that is sent to the user:
GET
/login
As mentioned earlier, the AFM manages also the authentication of the hosting application:
POST
/login
username: string
password: string
By calling the URL, the hosting application can get the password policy. e.g. constraints like length, number of Capital letters required, number of digits required etc. This way the UI can alert the user if the password he chooses does not meet the requirements, before the request is sent to the server.
GET
/getPasswordConstraints
renders the create account page that is sent to the user:
GET
/createAccount
POST
/createAccount
GET
/aa
GET
/forgotPassword
POST
/forgotPassword
GET
/rp
POST
/setNewPassword
POST
/deleteAccount
GET
/user get all users
PUT
/user/:email/authorities set authorities for user
all flows are tested very clearly using Cucumber automated tests.
https://www.smashingmagazine.com/2020/03/creating-secure-password-flows-nodejs-mysql/
https://en.wikipedia.org/wiki/Cryptographically_secure_pseudorandom_number_generator
Feel free to open issues here if you have any unclear matter or any other question.
reveiled by automation: authentication failure - do not "redirect", but "render" instead, so can send 401 and message #22
getAllUsers
, and setAuthorities
. so hosting app can manage authorization for users. #17redirectAfterLogin
.No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/23 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
17 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More