express-account-pages
Advanced tools
Comparing version
@@ -171,6 +171,2 @@ const session = require('express-session') | ||
// get information from html forms and post payload | ||
app.use(bodyParser.json()) | ||
app.use(bodyParser.urlencoded({ extended: true })) | ||
app.use(passport.initialize()) | ||
@@ -177,0 +173,0 @@ app.use(passport.session()) // persistent login sessions |
{ | ||
"name": "express-account-pages", | ||
"version": "0.6.0", | ||
"version": "1.0.0", | ||
"description": "A simple user middleware of abstraction for Express on top of Passport", | ||
@@ -16,3 +16,3 @@ "main": "index.js", | ||
"connect-mongo": "^2.0.3", | ||
"cookie-parser": "^1.4.3", | ||
"cookie-parser": "^1.4.4", | ||
"express-session": "^1.15.6", | ||
@@ -19,0 +19,0 @@ "passport": "^0.4.0", |
@@ -7,2 +7,6 @@ # express-account-pages | ||
A simple to use module for Express that handles authentification (signup and login) and provide a basic account page you can place in your app. | ||
Based on JQuery and Bootstrap. | ||
## Features | ||
@@ -15,5 +19,3 @@ | ||
- [X] Use Bootstrap | ||
- [ ] Google OAuth | ||
- [ ] Facebook OAuth | ||
- [ ] Better README | ||
- [X] OAuth (Google and Github) | ||
@@ -36,2 +38,6 @@ ## Usage | ||
// Parse from html forms and post payload | ||
app.use(express.json()) | ||
app.use(express.urlencoded({ extended: true })) | ||
// For signup and login | ||
@@ -44,7 +50,56 @@ require('express-account-pages')(app, { | ||
mongoose: mongoose, | ||
useAccessToken: true, // Access token management | ||
redirectLogin: '/account', | ||
redirectSignup: '/account', | ||
mongoUser: db.User | ||
// signupMailExtra: 'You can now create your first app.', | ||
mongoUser: db.User, | ||
connectors: { | ||
github: { | ||
clientId: "xxxxxxx", | ||
clientSecret: "xxxxxx", | ||
redirectUri: "https://my.app/auth/github/callback" | ||
}, | ||
google: { | ||
clientId: 'xxxxxxx.apps.googleusercontent.com', | ||
clientSecret: 'xxxxxxxxx', | ||
redirectUri: 'https://my.app/auth/google/callback' | ||
} | ||
} | ||
}) | ||
``` | ||
## Account page | ||
Will require Bootstrap and jQuery. | ||
In your express route: | ||
```javascript | ||
app.get("/account", (req, res, next) => { | ||
res.render("myaccountpage", { // Where account is your page structure | ||
accountTemplate: require.resolve("express-account-pages/account.ejs") | ||
}) | ||
}) | ||
``` | ||
Then, in your ejs: | ||
```html | ||
<body> | ||
<%- include(accountTemplate) %> | ||
</body> | ||
<script src="/account/account.js" defer></script> | ||
``` | ||
## Oauth | ||
Currently the module supports Github and Google oauth. | ||
The redirect URIs are predefined paths: | ||
- */auth/github/callback* for Github | ||
- */auth/google/callback* for Github |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
20059
7.12%2
-33.33%102
117.02%231
-1.28%Updated