0.1.6 • Published 3 years ago

@axolo/egg-oauth v0.1.6

Weekly downloads
25
License
MIT
Repository
github
Last release
3 years ago

egg-oauth

node-oauth2-server plugin for Egg.js.

Install

npm i @axolo/egg-oauth --save

Usage

// {app_root}/config/plugin.js
exports.oauth = {
  enable: true,
  package: '@axolo/egg-oauth',
};

Configuration

// {app_root}/config/config.default.js
exports.oauth = {
  client: {
    OAuth2Sever: require('oauth2-server'), // user defined oauth2-server version
    model: require('./oauth-model'), // model require
    accessTokenLifetime: 7200, // default 3600
    requireClientAuthentication: {
      password: false,
    },
  },
};

MUST build OAuth2 Model Specification at model in config by yourselves.

see config/config.default.js for more detail.

props

propsdescription
OAuth2Serverclass of OAuth2Server
Responseclass of OAuth2Server.Response
Requestclass of OAuth2Server.Request

model

A example of model.

// app/config/oauth-model.js
module.exports = (options, app) => ({
  getClient: (clientId, clientSecret) => {
    return { clientId, clientSecret };
  },
  // ...
});

TODO

  • get request in model

Questions & Suggestions

Please open an issue here.

License

MIT

0.1.6

3 years ago

0.1.4

3 years ago

0.1.5

3 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago