This module allow everybody to use ViaRézo Authentication (using OAuth2) very simply.

Usage no npm install needed!

<script type="module">
  import viarezoAuth from '';


ViaRézo Auth Module

What do this module do

It provides a middleware and a request path to handle oauth2 protocol at ViaRézo, for web servers using Express 4.

Why would I use it ?

Because it is very simple, and very usefull. You won't need mush time to set a ViaRézo Authentication on your website.

How to use it ?

First of all, you need to have a client registered on, its id and secret. Donc forget to add to redirect uri.

  1. Include the module in your project : npm install --save viarezo-auth
  2. Include this fiew lines in your app :
  • Include these modules needed by viarezo-auth (don't forget to install them) : const bodyParser = require('body-parser'); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: true })); const session = require('express-session'); app.use(session({ secret: 'yourSecret', resave: false, proxy: true, // Especially if unsing nginx/apache saveUninitialized: true, cookie: { secure: true } }));
  • Include viarezo-auth module : const auth = require("viarezo-auth"); app.use(auth.OAuthMiddleware(config)); app.get('/auth', (req,res)=>auth.AuthCallback(req, res));
  • The most important thing is to give the right configuration to the middleware. config objects looks like : config = { client_id: my_client_id, client_secret: even_more_secret, domain:, }
  1. You can access every information on the user in req.session.user object.

Version history

1.0.0 Allow only full authneticated website