# Manage registration whitelist

Configure a registration whitelist for your user pool, which is similar to the invitation registration rule. After opening, only users in the whitelist can register. Authing currently supports whitelisting methods such as mobile phone number, email address, and user name.

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.whitelist.list // Get registration whitelist record
managementClient.whitelist.add // add whitelist record
managementClient.whitelist.remove // ​​remove whitelist records

# Get whitelist records

WhitelistManagementClient().list(type)

Get whitelist record

# Parameters

  • type <WhitelistType> Whitelist type, USERNAME is user name, Email is mailbox, Phone is mobile phone number.

# Example

import {WhitelistType} from "authing-js-sdk"
const list = await managementClient.whitelist.list(WhitelistType.Email);

# return value

  • Promise<WhiteList[]>

# Add whitelist

WhitelistManagementClient().add(type, list)

Add whitelist

# Parameters

  • type <WhitelistType> Whitelist type, USERNAME is user name, Email is mailbox, Phone is mobile phone number.
  • list <string[]> Whitelist list, please note that the mailbox is not case sensitive.

# Example

await managementClient.whitelist.add(WhitelistType.Email,'a@example.com');

# return value

  • Promise<WhiteList[]>

# Remove whitelist

WhitelistManagementClient().remove(type, list)

Remove whitelist

# Parameters

  • type <WhitelistType> Whitelist type, USERNAME is user name, Email is mailbox, Phone is mobile phone number.
  • list <string[]> Whitelist list, please note that the mailbox is not case sensitive.

# Example

await managementClient.whitelist.remove(WhitelistType.Email,'a@example.com');

# return value

  • Promise<WhiteList[]>

# Open whitelist

WhitelistManagementClient().enable(type)

Open whitelist

# Parameters

  • type <WhitelistType> Whitelist type, USERNAME is user name, Email is mailbox, Phone is mobile phone number.

# Example

// add whitelist

import {WhitelistType} from "authing-js-sdk"
await managementClient.whitelist.enable(WhitelistType.Email);
await managementClient.whitelist.add(WhitelistType.Email, [‘a@wxample.com’]);

// Register with an account that is not in the whitelist, and you cannot register without prompting.

await authing.registerByEmail(email,'b@example.com');

# Close whitelist

WhitelistManagementClient().disable(type)

Close whitelist

# Parameters

  • type <WhitelistType> Whitelist type, USERNAME is user name, Email is mailbox, Phone is mobile phone number.

# Example