0.2.74 • Published 4 years ago
express-oauth2-client v0.2.74
Express OAuth2 Client
Installation
$ npm i express-oauth2-client
Basic Usage
import ExpressOAuth2Client from 'express-oauth2-client';
import express from 'express';
import session from 'express-session';
import config from 'config';
const app = express();
const oauth2Client = new ExpressOAuth2Client(app, {
providers: config.get('oauth2'),
homeUrl: '/home',
prefix: '/oauth2',
});
app.use(
session({
secret: config.get('session.secret'),
resave: false,
saveUninitialized: true,
cookie: { secure: false },
})
);
app.use(oauth2Client.initialize());
app.use(oauth2Client.getLoggingMiddleware());
// add your routes here
app.listen(8000, () => {
console.log('Server started on port: 8000');
});
Providers config object structure
{
"github": {
"clientId": "",
"clientSecret": "",
"scopes": ["user", "repo"]
},
"twitter": {
"clientId": "",
"clientSecret": "",
"scopes": ["profile", "email"]
},
"google": {
"clientId": "",
"clientSecret": "",
"scopes": ["profile", "email"]
}
}
Registering Callbacks
This package has handlers set up for callback on the url '/{prefix}/callback/{provider}' So for example, if you set the prefix in the options as '/oauth2' and the provider is twitter. Then the callback url that you need to register on twitter's developer website is '/oauth2/callback/twitter'
Supported Providers
- Github
0.2.74
4 years ago
0.2.73
4 years ago
0.2.72
4 years ago
0.2.71
4 years ago
0.2.7
4 years ago
0.2.6
4 years ago
0.2.5
4 years ago
0.2.4
4 years ago
0.2.3
4 years ago
0.2.2
4 years ago
0.2.1
4 years ago
0.2.0
4 years ago
0.1.9
4 years ago
0.1.8
4 years ago
0.1.7
4 years ago
0.1.6
4 years ago
0.1.5
4 years ago
0.1.4
4 years ago
0.1.3
4 years ago
0.1.2
4 years ago
0.1.1
4 years ago
0.1.0
4 years ago
0.0.9
4 years ago
0.0.8
4 years ago
0.0.7
4 years ago
0.0.6
4 years ago
0.0.5
4 years ago
0.0.4
4 years ago
0.0.3
4 years ago
0.0.2
4 years ago
0.0.1
4 years ago