¶ UsersManagementClient
Authing User ManagementClient
This client is used to manage Authing users. It can create, query, update and delete users, refresh user token, manage user's group, user's role, user's policy and perform other operations.
¶ Create a user
UsersManagementClient().create(userInfo)
An administrator can use this interface to create a user and the this process does not need to perform security checks such as SMS code verification and other verifications.
¶ Parameters
userInfo
<CreateUserInput> User informationuserInfo.email
<string> Email, unique in the user pooluserInfo.emailVerified
<boolean> Is the email verified?userInfo.phone
<string> phone numberuserInfo.phoneVerified
<boolean> Whether the phone number is verifieduserInfo.unionid
<string> For the social login user, this field is the unique ID of the user in the third-party social login identity provideuserInfo.password
<string> passworduserInfo.registerSource
<string> Registration source, you can choose multipleuserInfo.username
<string> usernameuserInfo.nickname
<string> nicknameuserInfo.photo
<string> AvataruserInfo.company
<string> companyuserInfo.browser
<string> browseruserInfo.loginsCount
<number> The number of logins. This field can be set when you migrate from the original user system to Authing.userInfo.lastLogin
<string> Last login time, a time string conforming to the ISO8601 format. (E.g. "2017-06-07T14:34:08.700Z", "2017-06-07T14:34:08.700 or "2017-06-07T14:34:08+04:00")userInfo.lastIP
<string> The last login (or other activity) IP of the useruserInfo.signedUp
<string> Registration time, a time string in ISO8601 format. (E.g. "2017-06-07T14:34:08.700Z", "2017-06-07T14:34:08.700 or "2017-06-07T14:34:08+04:00")userInfo.blocked
<boolean> Whether the account is disableduserInfo.isDeleted
<boolean> mark whether the account is deleteduserInfo.device
<string> deviceuserInfo.lastIP
<string> Last logged in IPuserInfo.name
<string> NameuserInfo.givenName
<string> Given NameuserInfo.familyName
<string> Family NameuserInfo.middleName
<string> Middle NameuserInfo.profile
<string> Profile UrluserInfo.preferredUsername
<string> Preferred NameuserInfo.website
<string> personal websiteuserInfo.gender
<string> Gender, M (Man) means male, F (Female) means female, U (Unknown) means unknownuserInfo.birthdate
<string> birthdayuserInfo.zoneinfo
<string> time zoneuserInfo.locale
<string> languageuserInfo.address
<string> addressuserInfo.streetAddress
<string> street addressuserInfo.locality
<string>userInfo.region
<string> RegionuserInfo.postalCode
<string> Zip codeuserInfo.city
<string> CityuserInfo.province
<string> ProvinceuserInfo.country
<string> country
¶ Example
$email = "test@example.com";
$password = '123456';
$user = $managementClient->users()->create((new CreateUserInput())->withEmail($email)->withPassword($password));
¶ Update user information
UsersManagementClient *().update(id, updates)
Update user information
¶ Parameters
id
<string> user IDupdates
<UpdateUserInput> Modified user informationupdates.email
<string> emailupdates.emailVerified
<boolean> Whether the email is verifiedupdates.phone
<string> phone numberupdates.phoneVerified
<boolean> Whether the phone number is verifiedupdates.unionid
<string> For the social login user, this field is the unique ID of the user in the third-party social login identity providerupdates.password
<string> passwordupdates.registerSource
<string> Registration source, you can select multipleupdates.tokenExpiredAt
<string> The token expiration time, a time string in the ISO8601 format. (Such as "2017-06-07T14:34:08.700Z", "2017-06-07T14:34:08.700 or "2017-06-07T14:34:08+04:00"). Set the field to be earlier than the current time can make the user's token invalid.updates.username
<string> usernameupdates.nickname
<string> nicknameupdates.photo
<string> avatarupdates.company
<string> companyupdates.browser
<string> browserupdates.loginsCount
<number> The number of login times. This field can be set when you migrate from the original user system to Authing.updates.lastLogin
<string> Last login time, a time string in the ISO8601 format. (E.g. "2017-06-07T14:34:08.700Z", "2017-06-07T14:34:08.700 or "2017-06-07T14:34:08+04:00")updates.lastIP
<string> The IP of the user's last login (or other activity)updates.signedUp
<string> Registration time, a time string in the ISO8601 format. (E.g. "2017-06-07T14:34:08.700Z", "2017-06-07T14:34:08.700 or "2017-06-07T14:34:08+04:00")updates.blocked
<boolean> Whether the account is disabledupdates.device
<string> deviceupdates.lastIP
<string> Last logged in IPupdates.name
<string> Nameupdates.givenName
<string> Given Nameupdates.familyName
<string> Family Nameupdates.middleName
<string> Middle Nameupdates.profile
<string> Profile Urlupdates.preferredUsername
<string> Preferred Nameupdates.website
<string> personal websiteupdates.gender
<string> Gender, M means male, F means female, U means unknownupdates.birthdate
<string> birthdayupdates.zoneinfo
<string> timezoneupdates.locale
<string> langeageupdates.address
<string> addressupdates.streetAddress
<string> street addressupdates.locality
<string>updates.region
<string> regionupdates.postalCode
<string> zipcodeupdates.city
<string> cityupdates.province
<string> provinceupdates.country
<string> country
¶ Example
¶ Get user details
UsersManagementClient().detail(userId)
Get user details by user ID. If you want to get user details by token, please use AuthenticationClient SDK.
¶ Parameter
userId
<string> user ID
¶ Example
$user = $managementClient->users()->detail("userId");
¶ Delete a user
UsersManagementClient().delete(userId)
Delete a user
¶ Parameter
userId
<string> user ID
¶ Example
$message = $managementClient->users()->delete("userId");
¶ Batch delete users
UsersManagementClient().deleteMany(userIds)
Batch delete users
¶ Parameter
userIds
<string[]> user ID list
¶ Example
$message = $managementClient->users()->deleteMany(["userId"]);
¶ Batch get users
UsersManagementClient().batch(userIds)
Batch get user details by ID
¶ Parameter
userIds
<string[]> user ID list
¶ Example
$users = $managementClient->users()->batch(["userId"]);
¶ Get user list
UsersManagementClient().list(page, limit)
Get the user list in the user pool.
¶ Parameter
page
<number> Page number, starting from 1. The default value is:1
.limit
<number> The number of users per page. The default value is:10
.
¶ Example
$users = $managementClient->users()->paginate();
¶ Find a user
UsersManagementClient().find(options)
Find a user by username, email, and phone number.
¶ Parameter
options
<Object>options.username
<string> User name, case sensitive.options.email
<string> The email address, which is not case sensitive.options.phone
<string> phone number
¶ Example
¶ Search users
UsersManagementClient().search(query, options, page, limit)
Search users based on keywords.
¶ Parameter
query
<null> search contentoptions
<string[]> search optionsoptions.fields
<string[]> Search user fields. If not specified, the default will be fuzzy search fromusername
,nickname
,email
,phone
,company
,name
,givenName
,familyName
,middleName
,profile
andpreferredUsername
fields. If you need a precise search, please use thefind
method.page
<number> The default value is:1
.limit
<number> The default value is:10
.
¶ Example
$users = $managementClient->users()->search("query");
¶ Refresh user token
UsersManagementClient().refresh_token(id)
Refresh user token
¶ Parameter
id
<string> user ID
¶ Example
$message = $managementClient->users()->refreshToken("userId");
¶ Get user group list
UsersManagementClient().list_groups(userId)
Get user group list
¶ Parameter
userId
<string> user ID
¶ Example
$list = $managementClient->users()->listGroups("userId");
¶ Join a group
UsersManagementClient().add_group(userId, group)
Add a user to a group.
¶ Parameter
userId
<string> user IDgroup
<string> group code
¶ Example
$managementClient->users()->addGroup("userId", "group code");
¶ Quit a group
UsersManagementClient().remove_group(userId, group)
Remove the user from a group.
¶ Parameter
userId
<string> user IDgroup
<string> group code
¶ Example
$managementClient->users()->removeGroup("userId", "group code");
¶ Get user role list
UsersManagementClient().list_roles(userId)
Get user role list.
¶ Parameter
userId
<string> user ID
¶ Example
$roles = $managementClient->users()->listRoles("userId");
¶ Add roles
UsersManagementClient().add_roles(userId, roles)
Add roles to the user.
¶ Parameter
userId
<string> user IDroles
<string> role code list
¶ Example
$managementClient->users()->addRoles("userId", ["role code"]);
¶ Remove roles
UsersManagementClient().remove_roles(userId, roles)
Remove roles from the user.
¶ Parameter
userId
<string> user IDroles
<string> role code list
¶ Example
$message = $managementClient->users()->removeRoles("userId", ["role code"]);