@cheapreats/express-security

1.0.3 • Public • Published

CE Express Security

This package allows developers to easily use CheaprEats unified authorization system with their express applications.

You must be registered as a CheaprEats developer to use this package, you must also obtain your OAuth client ID and secret.

Quick Start

First make sure you have express-session installed, this is required to maintain a login session.

Install the security module by running

$ npm install @cheapreats/express-security

Currently, this package only handles OAuth, so you can import a function called configureOAuth.

import {configureOAuth} from '@cheapreats/express-security'

Configure your application, for example, the following code will require OAuth for all paths starting with /secure.

configureOAuth(app, {
    path: /^\/secure.*$/,
    clientId: 'abcd...' // Your OAuth client ID
});

Within these paths, you can now access the variable req.ce if user is authorized. It is an object with the following fields

  • userId ID of the user that is currently authorized.
  • accessToken Access token, you can use this to call other APIs.

Copyright © CheaprEats Inc. 2020

POC: jun.zheng@

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.30latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.30
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i @cheapreats/express-security

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

179 kB

Total Files

12

Last publish

Collaborators

  • junthehacker
  • ralph-dev
  • bholagabbar