0.2.1 • Published 7 years ago
yion-oauth v0.2.1
YION OAUTH PLUGIN
A OAuth plugin for framework Yion
You need a OAuth authorize token server
Install
$ npm install --save yion-oauth
Usage
const { createServer, createApp } = require('yion');
const security = require('yion-oauth')(urlToValidateToken, methodOfUrl);
const app = createApp();
const server = createServer(app, [security]);
app.get('/', (req, res) => {
req.isAuthenticated().then().catch();
});
API reference
Response render method :
isAuthenticated(token=null)
: call OAuth authorize server to validate token (from headers'Authorization' or from token parameter)