# user object

The user object saves various data of the current user, as well as methods for adding custom fields and custom token fields.

Pre-Register (before registration) There is no user object in the Pipeline.

# user object

The user object saves various data of the current user, as well as methods for adding custom fields and custom token fields.

Pre-Register (before registration) There is no user object in the Pipeline.

# Attributes

| Property name | Value type | Description | | ------------------------ | ------- | ---------------- ---- | | id | string | User ID | | username | string | username | | email | string | Email | | emailVerified | boolean | Is the email verified | | phone | string | phone number | | phoneVerified | boolean | Is the phone number verified | | photo | string | Avatar link | | nickname | string | nickname | | gender | string | gender | | signedUp | string | Sign-up time, the format is 2020-02-07T04:29:40.877Z | | lastLogin | string | Last login time, the format is 2020-02-07T04:29:40.877Z | | oauth | string | Social login information | | registerMethod | string | Register Method | | blocked | boolean | Is it blocked | | company | string | company name | | browser | string | Visit browser | | device | string | access device | | country | string | country | | region | string | region | | address | string | address |

# Method

Method Name Description Sample Code
addCustomData Add user-defined fields. You need to define preset user-defined fields at the user pool level before setting them for users in the Pipeline. user.addCustomData("KEY", "VALUE")
addToken Not recommended, this method is currently only compatible with older version Authing users, please use the following addIdToken method. Calling this method can add custom fields to the token when issuing the token to the user. The new fields will appear under the token.payload.data object. The length of VALUE cannot exceed 100 characters, otherwise the token will be too long. To learn how to verify and decrypt Token, please see Verify Token. **This interface is only available in the POST_AUTHENTICATION (after login) pipeline. ** user.addToken('KEY','VALUE')
addIdToken Set idToken custom fields, which can also be used to replace the original idToken content. **This interface is only available in Pre-OIDCTokenIssued Pipeline. ** user.addIdToken("KEY","VALUE")