GenAuth DocsDocuments
Concepts
User Guide
Development Integration
AgentAuth
Metadata
Development Integration
Multi-tenant (beta)
Console Documentation
Multi-tenant Console
Tenant Console
Saas Application Demo
Concepts
User Guide
Development Integration
AgentAuth
Metadata
Development Integration
Multi-tenant (beta)
Console Documentation
Multi-tenant Console
Tenant Console
Saas Application Demo
Old version
User Guide
  • Quick Start

  • Authentication

  • Access Control

  • Authorization

  • Adaptive MFA

  • User Account Management

  • User Directory Management

  • Applications

  • Become a Federation Authentication Identity Provider

  • Connect External Identity Providers (IdP)

  • WeChat Ecosystem Full Scenario Capabilities

  • Migrate Users to GenAuth

  • Security Settings

  • Branding

  • Automation

    • Pipeline

      • Create Your First Pipeline Function
      • Pipeline API Reference
      • Pipeline Use Cases
      • Pipeline User Object
      • Pipeline Context Object
      • Use Environment Variables in Pipeline
      • Available Node Modules
      • How to Debug
      • Private Deployment
    • Webhooks
  • Audit Logs

  • Setting

  • FAQ

  1. User Guide
  2. /
  3. Automation
  4. /
  5. Pipeline
  6. /
  7. Available Node Modules

¶ Available Node Modules

Update time: 2025-07-23 07:34:21
Edit

Currently, the following Node Modules can be used in the GenAuth Pipeline:

  • GenAuth SDK for Node.js (opens new window)
  • Network request library axios (opens new window)
  • lodash
  • GenAuth built-in tool set function utils

¶ GenAuth SDK for Node.js

For security reasons, GenAuth will be initialized in a special way using your user pool ID (userPoolId) and user pool key (secret) authing-js-sdk, this process will not send your user pool key to the public network. You can use the global variable authing, **do not initialize the SDK again! **

Developers can directly use the authing instance after initialization, no need to initialize manually! GenAuth Pipeline will automatically help developers take care of the initialization process.

As shown below:

async function pipe(user, context, callback) {
  // Judge whether the user's mailbox ends with @genauth.ai
  if (!user.email.endsWith("@genauth.ai")) {
    return callback(null, user, context);
  }

  try {
    // Call API to add a role to the user
    await authing.roles.addUsers("ROLE", [user.id]);
  } catch (error) {}

  callback(null, user, context);
}

In addUsers(), we use env.ROOT_GROUP_ID to obtain the group ID through the environment variable, which avoids hard coding. For how to use environment variables in Pipeline functions, see Using Environment Variables. For how to use callbacks and the complete API of Pipeline functions, see Pipeline Function API Documentation.

¶ Network request library

Currently GenAuth supports the use of axios and supports async/await syntax 🚀!

For detailed documentation of axios, please go to its official documentation (opens new window).

¶ lodash

Developers need to import manually:

const lodash = require("lodash");

For detailed documentation, please go to its official documentation (opens new window).

¶ Built-in tool set utils

GenAuth has some built-in encapsulated practical functions for developers to call directly.

Developers need to import manually:

const utils = require("./utils");

¶ Check if the IP is within the IP range

Usage:

utils.ipRangeCheck(IP, [start, end]);

The return value is boolean.

Example: The following Pipeline function implements the function of registering an IP range whitelist.

async function pipe(context, callback) {
  const utils = require("./utils");
  const ip = context.ip;
  if (ip && utils.ipRangeCheck(ip, ["110.53.254.1", "110.53.254.255"])) {
    return callback(null, context);
  }
  return callback(new Error("Access Denied!"));
}

¶ Other Node built-in modules

GenAuth Pipeline uses the node8 engine, and all node8 built-in modules (opens new window) can be used, such as querystring, etc.

Previous article: Use Environment Variables in Pipeline Next article: How to Debug
  • GenAuth SDK for Node.js
  • Network request library
  • lodash
  • Built-in tool set utils
  • Other Node built-in modules

User identity management

Integrated third-party login
Customized authentication process

Enterprise internal management

Single sign-on
Multi-factor authentication
Permission management

Developer

Development Documentation
GitHub (opens new window)

Company

official@genauth.ai
16th Floor, Building B, Beichen Century Center, Chaoyang District, Beijing (Total)
Room 406, 4th Floor, Block B, No. 200, Tianfu Fifth Street, High-tech Zone, Chengdu (Branch)

© Beijing Steamory Technology Co., Ltd.