egg-gymbo-auth

raw JSON →
1.3.9 verified Sat Apr 25 auth: no javascript maintenance

Egg.js authentication middleware plugin for Gymboree services. Current stable version is 1.3.9, compatible with Egg 1.x only (not 2.x). Provides JWT-based authentication middleware for Egg.js applications. Compared to generic auth libraries, it is tailored for Gymboree's internal authentication flow with opinionated defaults. Release cadence is low, with maintenance updates as needed due to Egg 1.x legacy support. No alternative non-Egg plugins cover the same Gymboree-specific auth patterns.

error Error: Cannot find module 'egg-gymbo-auth'
cause Package not installed or name misspelled.
fix
Run 'npm install egg-gymbo-auth' and check spelling in plugin.js.
error TypeError: app.middleware.gymboAuth is not a function
cause Plugin not enabled or middleware not registered correctly.
fix
Ensure plugin is enabled in config/plugin.js and that the plugin has been loaded (check if it requires Egg 1.x).
breaking This plugin only supports Egg 1.x, not Egg 2.x or later.
fix Upgrade to Egg 2.x and use a compatible auth plugin.
gotcha The package name is 'egg-gymbo-auth', but the README header says 'egg-gymboree-auth'. Ensure you install the correct package.
fix Install with 'npm install egg-gymbo-auth'.
deprecated Node.js >=8.0.0 required, but Node 8 is end-of-life. Consider upgrading Node version.
fix Use Node.js 10+ or later.
npm install egg-gymbo-auth
yarn add egg-gymbo-auth
pnpm add egg-gymbo-auth

Shows how to enable the plugin, configure it, and apply the middleware to a route.

// config/plugin.js
exports.gymboAuth = {
  enable: true,
  package: 'egg-gymbo-auth',
};

// config/config.default.js
exports.gymboAuth = {
  secret: process.env.AUTH_SECRET || 'default-secret',
  ignore: ['/login', '/register'],
};

// app/router.js
module.exports = app => {
  const { router, controller, middleware } = app;
  router.get('/protected', middleware.gymboAuth(), controller.home.protected);
  router.get('/login', controller.home.login);
};

// app/controller/home.js
exports.protected = async ctx => {
  ctx.body = { message: 'Authenticated', user: ctx.state.user };
};
exports.login = async ctx => {
  // dummy login
  ctx.body = { token: 'fake-token' };
};