Skip to content

kevinbalicot/yion-oauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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)