# Manage user pool configuration

Authing user pool configuration management module.

Please use the module in the following ways:

import {ManagementClient} from "authing-js-sdk"
const managementClient = new ManagementClient({
   userPoolId: "YOUR_USERPOOL_ID",
   secret: "YOUR_USERPOOL_SECRET",
})

managementClient.userpool.detail // Get user pool configuration
managementClient.userpool.update // modify user pool configuration
managementClient.userpool.env // Get the list of environment variables configured by the user pool

# Query user pool configuration

UserPoolManagementClient().detail()

Query user pool configuration

# Parameters

# Example

const userpool = await managementClient.userpool.detail()

# return value

  • Promise<UserPool>

# Update user pool configuration

UserPoolManagementClient().update(updates)

Update user pool configuration

# Parameters

  • updates <UpdateUserpoolInput>
  • updates.name <string> user pool name
  • updates.logo <string> user pool logo
  • updates.domain <string> User pool enterprise application panel second-level domain name
  • updates.description <string> description information
  • updates.emailVerifiedDefault <boolean> set the mailbox to be verified by default (the user's emailVerified field is true)
  • updates.sendWelcomeEmail <boolean> Whether to send welcome email after user registration
  • updates.registerDisabled <boolean> Whether to close the registration, when the user pool closes the registration, ordinary users will not be able to register accounts, only the administrator can manually create accounts.
  • updates.allowedOrigins <string> Security domain configuration, security domain (Allowed Origins) is the URL that allows requests from JavaScript to the Authing API (usually used with CORS). By default, the system will allow you to use all URLs. If required, this field allows you to enter other sources. You can separate multiple valid URLs line by line and use wildcards at the subdomain level (for example: https://*.sample.com). The query string and hash information are not considered when verifying these URLs. If you bring the query string and hash information, the system will automatically ignore the entire domain name. If there are more than one, please separate them with line breaks.
  • updates.whitelist <Object> User pool whitelist configuration
  • updates.whitelist.phoneEnabled <boolean> Whether to enable the whitelist of mobile phone numbers
  • updates.whitelist.emailEnabled <boolean> Whether to enable the mailbox whitelist
  • updates.whitelist.usernameEnabled <boolean> Whether to enable username whitelist
  • updates.tokenExpiresAfter <number> token expiration time
  • updates.loginFailCheck <Object> Frequent login failure limit, after opening, after the specified time exceeds the number of times, a verification code is required to log in again. If your business has concurrent logins in the same area and time period, please turn off this detection. -Whether updates.loginFailCheck.enabled <boolean> is enabled
  • updates.loginFailCheck.timeInterval <number> The detection period, in seconds.
  • updates.loginFailCheck.limit <number> The limit condition will be triggered when the number of login failures for the same IP reaches.
  • updates.frequentRegisterCheck <Object> frequency registration limit. After opening the same IP frequently registering an account will trigger the frequency limit, it will take a while to register again. If your business has concurrent registration scenarios in the same area and time period, please turn off this detection. -Whether updates.frequentRegisterCheck.enabled <boolean> is enabled
  • updates.frequentRegisterCheck.timeInterval <Object> detection period, in seconds.
  • updates.frequentRegisterCheck.limit <Object> The frequency limit will be triggered when the number of registrations of the same IP in the same period reaches this number.

# Example

const userpool = await managementClient.userpool.update({
 registerDisabled: true // Close system registration
})

# return value

  • Promise<UserPool>

# Get a list of environment variables

UserPoolManagementClient().listEnv()

Get the list of user pool environment variables. The environment variables configured by the user pool can be used in the pipeline scenario, please see: https://docs.authing.co/extensibility/pipeline/env.html

# Parameters

# Example

const envList = await managementClient.userpool.listEnv()

# return value

  • Promise<Env[]>

# Add environment variables

UserPoolManagementClient().addEnv(key, value)

Add environment variables

# Parameters

  • key <string> environment variable key
  • value <any> environment variable value

# Example

const envList = await managementClient.userpool.addEnv('LARK_WEBHOOK','xxxxxxx') // Add a Feishu group robot webhook address, then you can use it in the pipeline function (see: https://docs.authing.co for details /extensibility/pipeline/usage.html)

# return value

  • Promise<Env[]> returns the latest list of environment variables

# Delete environment variables

UserPoolManagementClient().removeEnv(key)

Delete environment variables

# Parameters

  • key <string> environment variable key

# Example

const envList = await managementClient.userpool.removeEnv('LARK_WEBHOOK')

# return value

  • Promise<Env[]> returns the latest list of environment variables