Skip to content

Jeff-Tian/egg-passport-citi

Repository files navigation

egg-passport-citi

Citi passport plugin for egg.

NPM version Build Status codecov David deps Known Vulnerabilities npm download

Quality gate

Example

Open https://uniheart.herokuapp.com/passport/citi to see the result.

Install

$ npm i egg-passport-citi --save

Usage

// {app_root}/config/plugin.[t|j]s
exports.passportCiti = {
  enable: true,
  package: "egg-passport-citi"
};

Configuration

// {app_root}/config/config.default.[t|j]s
exports.passportCiti = {
  key: "your oauth key",
  secret: "your oauth secret",
  callbackURL: "/your/callback-or-redirect/url",
  // state: your customized state function, default to uuid()
  state: function yourStateFunction(ctx) {}
};

Mount on your app

// {app_root}/app/router.ts
import { Application } from "egg";

export default (app: Application) => {
  app.passport.mount("citi", app.config.passportCiti);
};

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

Example

运行截图

Testing Accounts:

User ID Password
SandboxUser1 P@ssUser1$
SandboxUser2 P@ssUser2$
SandboxUser3 P@ssUser3$
SandboxUser4 P@ssUser4$
SandboxUser5 P@ssUser5$

License

MIT

Test

npm run test-local

Release Notes: