A OAuth plugin for framework Yion
You need a OAuth authorize token server
$ npm install --save yion-oauth
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();
});
Response render method :
-
isAuthenticated(token=null)
: call OAuth authorize server to validate token (from headers['Authorization'] or from token parameter)