Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/passport/todos-express-password
Todo app using Express and Passport for sign in with username and password.
https://github.com/passport/todos-express-password
example express nodejs passport password sqlite
Last synced: 3 days ago
JSON representation
Todo app using Express and Passport for sign in with username and password.
- Host: GitHub
- URL: https://github.com/passport/todos-express-password
- Owner: passport
- License: unlicense
- Created: 2015-08-15T19:07:55.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-12-05T12:46:31.000Z (about 1 year ago)
- Last Synced: 2024-10-30T00:55:34.822Z (3 months ago)
- Topics: example, express, nodejs, passport, password, sqlite
- Language: JavaScript
- Homepage:
- Size: 1.21 MB
- Stars: 880
- Watchers: 15
- Forks: 415
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# todos-express-password
This app illustrates how to use [Passport](https://www.passportjs.org/) with
[Express](https://expressjs.com/) to sign users in with a username and password.
Use this example as a starting point for your own web applications.## Quick Start
To run this app, clone the repository and install dependencies:
```bash
$ git clone https://github.com/passport/todos-express-password.git
$ cd todos-express-password
$ npm install
```Then start the server.
```bash
$ npm start
```Navigate to [`http://localhost:3000`](http://localhost:3000).
## Tutorial
Follow along with the step-by-step [Username & Password Tutorial](https://www.passportjs.org/tutorials/password/)
to learn how this app was built.## Overview
This app illustrates how to build a todo app with sign in functionality using
Express, Passport, and the [`passport-local`](https://www.passportjs.org/packages/passport-local/)
strategy.This app is a traditional web application, in which application logic and data
persistence resides on the server. HTML pages and forms are rendered by the
server and client-side JavaScript is not utilized (or kept to a minimum).This app is built using the Express web framework. Data is persisted to a
[SQLite](https://www.sqlite.org/) database. HTML pages are rendered using [EJS](https://ejs.co/)
templates, and are styled using vanilla CSS.When a user first arrives at this app, they are prompted to sign in. Once
authenticated, a login session is established and maintained between the server
and the user's browser with a cookie.After signing in, the user can view, create, and edit todo items. Interaction
occurs by clicking links and submitting forms, which trigger HTTP requests.
The browser automatically includes the cookie set during login with each of
these requests.When the server receives a request, it authenticates the cookie and restores the
login session, thus authenticating the user. It then accesses or stores records
in the database associated with the authenticated user.## Next Steps
* Extend with credential management.
Study [todos-express-password-credential-management](https://github.com/passport/todos-express-password-credential-management)
to learn how to use the [Credential Managment](https://www.w3.org/TR/credential-management-1/)
API to help the user store and select their password.* Add social login.
Study [todos-express-google](https://github.com/passport/todos-express-google)
to learn how to let users sign in with their social network account, using
their existing profile and avoiding the need to sign up and repeatedly enter
account details.* Add passwordless.
Study [todos-express-webauthn](https://github.com/passport/todos-express-webauthn)
to learn how to let users sign in with biometrics or a security key.## License
[The Unlicense](https://opensource.org/licenses/unlicense)
## Credit
Created by [Jared Hanson](https://www.jaredhanson.me/)