Stores the access and refresh tokens as part of the session (`express-session`), this way auth flow could be based on it.


Keywords
users, accounts, express, session, oauth, rest
License
MIT
Install
npm install @accounts/express-session@0.29.0

Documentation

rest

REST client and server for accounts.

CircleCI codecov MIT License

Getting Started

npm i -S @accounts/rest-express
import express from 'express';
import bodyParser from 'body-parser';
import { AccountsServer } from '@accounts/server';
import accountsExpress, { userLoader } from '@accounts/rest-express';

const app = express();
app.use(bodyParser.json());

const accountsServer = new AccountsServer({ ...options });
const accountsExpressOptions = { ...options };
app.use(accountsExpress(accountsServer, accountsExpressOptions));

// To bind all routes
app.use(userLoader(accountsServer));

// to bind a specific route
app.get('/protected', userLoader(accountsServer), (req, res) => {
  if (!req.user) {
    res.status(401).send();
    return;
  }
  res.send(req.user))
}