Skip to content

Modify user built-in field configuration

This document is automatically generated based on https://github.com/authing/authing-docs-factory based on https://api-explorer.genauth.ai V3 API, and is consistent with API parameters and return results. If this document description is incorrect, please refer to V3 API.

Modify user built-in field configuration. Built-in fields are not allowed to modify data types and uniqueness.

Method name

ManagementClient.setUserBaseFields

Request parameters

NameTypeRequiredDefault valueDescriptionSample value
list<a SetUserBaseFieldDto[]Yes-Custom field list Array length limit: 50.

Sample code

ts
import { ManagementClient, Models } from "authing-node-sdk";

// Initialize ManagementClient
const managementClient = new ManagementClient({
// Need to be replaced with your GenAuth Access Key ID
accessKeyId: "GEN_AUTH_ACCESS_KEY_ID",
// Need to be replaced with your GenAuth Access Key Secret
accessKeySecret: "GEN_AUTH_ACCESS_KEY_SECRET",
// If it is a private deployment customer, you need to set the GenAuth service domain name
// host: 'https://api.your-authing-service.com'
});

(async () => {
const result = await managementClient.setUserBaseFields({
list: [
{
key: "school",
label: "学校",
description: "学校",
userEditable: false,
visibleInAdminConsole: true,
visibleInUserCenter: true,
i18n: {
label: {
"zh-CN": {
enabled: false,
value: "中文",
},
"en-US": {
enabled: false,
value: "英文",
},
"zh-TW": {
enabled: false,
value: "繁體",
},
"ja-JP": {
enabled: false,
value: "日本文",
},
},
},
],
});

console.log(JSON.stringify(result, null, 2));
})();

Request response

Type: CustomFieldListRespDto

NameTypeDescription
statusCodenumberBusiness status code, which can be used to determine whether the operation is successful. 200 means success.
messagestringdescription
apiCodenumberSegmented error code, which can be used to get the specific error type (not returned for successful requests). For a detailed list of error codes, see: API Code List
requestIdstringRequest ID. Returned when the request fails.
dataarrayresponse data

Sample result:

json
{
  "statusCode": 200,
  "message": "Operation successful",
  "requestId": "934108e5-9fbf-4d24-8da1-c330328abd6c",
  "data": {
    "targetType": "USER",
    "createdAt": "2022-03-17T05:23:01.567Z",
    "dataType": "ENUM",
    "key": "school",
    "label": "School",
    "description": "School",
    "visibleInAdminConsole": true,
    "visibleInUserCenter": true,
    "i18n": {
      "label": {
        "zh-CN": {
          "enabled": false,
          "value": "Chinese"
        },
        "en-US": {
          "enabled": false,
          "value": "English"
        },
        "zh-TW": {
          "enabled": false,
          "value": "繁體中文"
        }
      }
    },
    "options": "[{\"value\":\"pku\",\"label\":\"Peking University\"}]"
  }
}

Data structure

SetUserBaseFieldDto

NameTypeIs it required?DescriptionSample value
keystringYesField key, cannot conflict with the key of built-in fields, cannot be modified after setting.school
labelstringnoDisplay nameschool
descriptionstringnoDetailed descriptionschool
userEditablebooleannoEditable by user
visibleInAdminConsolebooleannoWhether to display in the GenAuth console:
- If it is a user-defined field, control whether to display in user details;
- If it is a department-defined field, control whether to display in department details;
- If it is a role extension field, control whether to display in role details.
true
visibleInUserCenterbooleannoWhether to display in the user's personal center (this parameter does not control whether the API interface is returned).true
i18nnoMulti-language display name Nested type: <a CustomFieldI18n.{"label":{"zh-CN":{"enabled":false,"value":"中文"},"en-US":{"enabled":false,"value":"English"},"zh-TW":{"enabled":false,"value":"繁體中文"}}}

CustomFieldI18n

NameTypeIs it required?DescriptionSample value
labelYesFields that support multiple languages Nested type: <a LangObject.{"zh-CN":{"enabled":false,"value":"中文"},"en-US":{"enabled":false,"value":"English"},"zh-TW":{"enabled":false,"value":"繁體中文"},"ja-JP":{"enabled":false,"value":"日本語"}}

LangObject

NameTypeRequiredDescriptionSample value
zh-CNYesMultilingual Chinese content Nested type: <a LangUnit.{"enabled":false,"value":"中文"}
en-USYesMultilingual English content Nested type: <a LangUnit.{"enabled":false,"value":"English"}
zh-TWYesMultilingual Traditional Chinese content Nesting type: <a LangUnit.{"enabled":false,"value":"Traditional Chinese"}
ja-JPYesMultilingual Japanese content Nested type: <a LangUnit.{"enabled":false,"value":"日本语"}

LangUnit

NameTypeRequiredDescriptionExample value
enabledbooleanYesWhether it is enabled. If enabled and the language is selected in the console, the content will be displayed. (off by default)
valuestringyesmultilingual content

CustomFieldDto

NameTypeRequiredDescriptionExample value
targetTypestringyesTarget object type:
- USER: user
- ROLE: role
- GROUP: group
- DEPARTMENT: department
USER
createdAtstringNoCreation time, only valid for custom fields, built-in fields have no creation time.2022-03-17T05:23:01.567Z
dataTypestringYesdata type, cannot be modified after setting.
- STRING: string type
- NUMBER: numeric type
- DATETIME: date type
- BOOLEAN: boolean type
- ENUM: enum Value type
STRING
keystringis thefield key and cannot conflict with the key of the built-in field. It cannot be modified after it is set.school
labelstringyesdisplay nameschool
descriptionstringNoDetailed description informationschool
encryptedbooleanNoWhether to encrypt storage. When turned on, the new data in this field will be encrypted. Once this parameter is set, it cannot be changed.
isUniquebooleanYesWhether it is a unique field. After turning it on, the value reported by the current field will be uniquely verified. This parameter is only valid for fields whose data type is string and number.
userEditablebooleannoWhether the user can edit it. If it is a special field such as mobile phone number or email address, the user cannot modify it directly and needs to verify it first through verification code or other methods.
visibleInAdminConsolebooleanyesWhether it needs to be displayed in the GenAuth console:
- If it is a user-defined field, control whether it is displayed in the user details;
- If it is a department-defined field, control whether it is displayed in the department details;
- If it is a role extension field, control whether it is displayed in the role details.
true
visibleInUserCenterbooleannoWhether to display it in the user's personal center (this parameter does not control whether the API interface is returned).true
i18nnoMultilingual display name Nested type: <a CustomFieldI18n.{"label":{"zh-CN":{"enabled":false,"value":"中文"},"en-US":{"enabled":false,"value":"English"},"zh-TW":{"enabled":false,"value":"繁體中文"}}}
optionsarrayNoEnumeration value type selection Nested type: <a CustomFieldSelectOption.[{"value":"pku","label":"Peking University"}]

CustomFieldI18n

NameTypeIs it required?DescriptionSample value
labelYesFields that support multiple languages Nested type: <a LangObject.{"zh-CN":{"enabled":false,"value":"中文"},"en-US":{"enabled":false,"value":"English"},"zh-TW":{"enabled":false,"value":"繁體中文"},"ja-JP":{"enabled":false,"value":"日本語"}}

LangObject

NameTypeRequiredDescriptionSample value
zh-CNYesMultilingual Chinese content Nested type: <a LangUnit.{"enabled":false,"value":"中文"}
en-USYesMultilingual English content Nesting type: <a LangUnit.{"enabled":false,"value":"English"}
zh-TWYesMultilingual Traditional Chinese content Nesting type: <a LangUnit.{"enabled":false,"value":"繁體中文"}
ja-JPYesMultilingual Japanese content Nesting type: <a LangUnit.{"enabled":false,"value":"日本語"}

LangUnit

NameTypeIs it required?DescriptionSample value
enabledbooleanyesIs it enabled? If enabled, and the console selects this language, the content will be displayed. (Closed by default)
valuestringyesMultilingual content

CustomFieldSelectOption

NameTypeIs it requiredDescriptionSample value
valuestringyesenumeration value valuehust
labelstringyesenumeration value labelHuazhong University of Science and Technology

Agent infrastructure for identity, memory, and web action.