Class UsersClient
- Namespace
- Auth0.Management
Api .Clients
- Assembly
- Auth0.ManagementApi.dll
Contains methods to access the /users endpoints.
- Inheritance
-
Users
Client
- Implements
- Inherited Members
Constructors
UsersClient(IManagementConnection, Uri, IDictionary<string, string>)
Initializes a new instance of Users
public UsersClient(IManagementConnection connection, Uri baseUri, IDictionary<string, string> defaultHeaders)
Parameters
connection
IManagementConnection IManagement
Connection used to make all API calls.baseUri
UriUri of the endpoint to use in making API calls.
defaultHeaders
IDictionary<string, string>Dictionary containing default headers included with every request this client makes.
Methods
AssignPermissionsAsync(string, AssignPermissionsRequest, CancellationToken)
Assign permissions to a user.
public Task AssignPermissionsAsync(string id, AssignPermissionsRequest request, CancellationToken cancellationToken = default)
Parameters
id
stringThe ID of the user to assign permissions to.
request
AssignPermissions Request A Assign
Permissions containing the permission identifiers to assign to the user.Request cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
AssignRolesAsync(string, AssignRolesRequest, CancellationToken)
Assigns Roles to a user.
public Task AssignRolesAsync(string id, AssignRolesRequest request, CancellationToken cancellationToken = default)
Parameters
id
stringThe ID of the user to assign roles to.
request
AssignRoles Request A Assign
Roles containing the role IDs to assign to the user.Request cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
CreateAsync(UserCreateRequest, CancellationToken)
Creates a new user.
public Task<User> CreateAsync(UserCreateRequest request, CancellationToken cancellationToken = default)
Parameters
request
UserCreate Request The User
Create containing the properties of the user to create.Request cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
CreateAuthenticationMethodAsync(string, AuthenticationMethodCreateRequest, CancellationToken)
Creates an authentication method for a given user.
public Task<AuthenticationMethod> CreateAuthenticationMethodAsync(string userId, AuthenticationMethodCreateRequest request, CancellationToken cancellationToken = default)
Parameters
userId
stringThe ID of the user for which you want to create the authentication method.
request
AuthenticationMethod Create Request The Authentication
Method containing the properties of the authentication method to create.Create Request cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
- Task<Authentication
Method > The newly created Authentication
Method .
Remarks
Authentication methods created via this endpoint will be auto confirmed and should already have verification completed.
DeleteAsync(string)
Deletes a user.
Parameters
id
stringThe id of the user to delete.
Returns
DeleteAuthenticationMethodAsync(string, string, CancellationToken)
Deletes an authentication method by id,.
public Task DeleteAuthenticationMethodAsync(string userId, string authenticationMethodId, CancellationToken cancellationToken = default)
Parameters
userId
stringThe ID of the user for which you want to delete the authentication methods.
authenticationMethodId
stringThe ID of the authentication method you want to delete.
cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
DeleteAuthenticationMethodsAsync(string, CancellationToken)
Deletes all authentication methods for the given user.
public Task DeleteAuthenticationMethodsAsync(string userId, CancellationToken cancellationToken = default)
Parameters
userId
stringThe ID of the user for which you want to update the authentication methods.
cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
DeleteMultifactorProviderAsync(string, string, CancellationToken)
Deletes a user's multifactor provider.
public Task DeleteMultifactorProviderAsync(string id, string provider, CancellationToken cancellationToken = default)
Parameters
id
stringThe id of the user who multi factor provider to delete.
provider
stringThe type of the multifactor provider. Supported values 'duo' or 'google-authenticator'.
cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
GenerateRecoveryCodeAsync(string, CancellationToken)
Generate new Guardian recovery code.
public Task<GenerateRecoveryCodeResponse> GenerateRecoveryCodeAsync(string id, CancellationToken cancellationToken = default)
Parameters
id
stringThe user_id of the user which guardian code will be regenerated.
cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
- Task<Generate
Recovery >Code Response A Task representing the operation and potential return value.
GetAllAsync(GetUsersRequest, PaginationInfo, CancellationToken)
Lists or search for users based on criteria.
public Task<IPagedList<User>> GetAllAsync(GetUsersRequest request, PaginationInfo pagination = null, CancellationToken cancellationToken = default)
Parameters
request
GetUsers Request Specifies criteria to use when querying users.
pagination
PaginationInfo Specifies pagination info to use when requesting paged results.
cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
- Task<IPaged
List <User>> An IPagedList<T> containing the list of users.
GetAllOrganizationsAsync(string, PaginationInfo, CancellationToken)
Lists organizations for a user.
public Task<IPagedList<Organization>> GetAllOrganizationsAsync(string userId, PaginationInfo pagination, CancellationToken cancellationToken = default)
Parameters
userId
stringThe ID of the user for which you want to retrieve the organizations.
pagination
PaginationInfo Specifies pagination info to use when requesting paged results.
cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
- Task<IPaged
List <Organization>> An IPagedList<T> containing the list of organizations.
GetAsync(string, string, bool, CancellationToken)
Gets a user.
public Task<User> GetAsync(string id, string fields = null, bool includeFields = true, CancellationToken cancellationToken = default)
Parameters
id
stringThe id of the user to retrieve.
fields
stringA comma separated list of fields to include or exclude (depending on includeFields) from the result, empty to retrieve all fields
includeFields
booltrue if the fields specified are to be included in the result, false otherwise (defaults to true)
cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
GetAuthenticationMethodAsync(string, string, CancellationToken)
Gets an authentication method for a given user.
public Task<AuthenticationMethod> GetAuthenticationMethodAsync(string userId, string authenticationMethodId, CancellationToken cancellationToken = default)
Parameters
userId
stringThe ID of the user for which you want to retrieve the authentication method.
authenticationMethodId
stringThe ID of the authentication method you want to retrieve.
cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
- Task<Authentication
Method > The Authentication
Method that was requested.
GetAuthenticationMethodsAsync(string, PaginationInfo, CancellationToken)
Gets a list of authentication methods.
public Task<IPagedList<AuthenticationMethod>> GetAuthenticationMethodsAsync(string userId, PaginationInfo pagination = null, CancellationToken cancellationToken = default)
Parameters
userId
stringThe ID of the user for which you want to retrieve the authentication methods.
pagination
PaginationInfo Specifies pagination info to use when requesting paged results.
cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
- Task<IPaged
List <AuthenticationMethod >> An IPagedList<T> containing the list of authentication methods.
GetEnrollmentsAsync(string, CancellationToken)
Get a list of Guardian enrollments.
public Task<IList<EnrollmentsResponse>> GetEnrollmentsAsync(string id, CancellationToken cancellationToken = default)
Parameters
id
stringThe user_id of the user to retrieve.
cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
- Task<IList<Enrollments
Response >> A Task representing the operation and potential return value.
GetLogsAsync(GetUserLogsRequest, PaginationInfo, CancellationToken)
Retrieve every log event for a specific user.
public Task<IPagedList<LogEntry>> GetLogsAsync(GetUserLogsRequest request, PaginationInfo pagination = null, CancellationToken cancellationToken = default)
Parameters
request
GetUser Logs Request Specifies criteria to use when querying logs for a user.
pagination
PaginationInfo Specifies pagination info to use when requesting paged results.
cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
- Task<IPaged
List <LogEntry >> An IPagedList<T> containing the log entries for the user.
GetPermissionsAsync(string, PaginationInfo, CancellationToken)
Get the permissions assigned to the user.
public Task<IPagedList<UserPermission>> GetPermissionsAsync(string id, PaginationInfo pagination = null, CancellationToken cancellationToken = default)
Parameters
id
stringThe id of the user to obtain the permissions for.
pagination
PaginationInfo Specifies Pagination
Info to use in requesting paged results.cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
- Task<IPaged
List <UserPermission >> An IPagedList<T> containing the assigned permissions for this user.
GetRolesAsync(string, PaginationInfo, CancellationToken)
Retrieve assigned roles for a specific user.
public Task<IPagedList<Role>> GetRolesAsync(string userId, PaginationInfo pagination = null, CancellationToken cancellationToken = default)
Parameters
userId
stringThe user id of the roles to retrieve.
pagination
PaginationInfo Specifies pagination info to use when requesting paged results.
cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
- Task<IPaged
List <Role>> An IPagedList<T> containing the roles for the user.
GetUsersByEmailAsync(string, string, bool?, CancellationToken)
Gets all users by email address.
public Task<IList<User>> GetUsersByEmailAsync(string email, string fields = null, bool? includeFields = null, CancellationToken cancellationToken = default)
Parameters
email
stringThe email address to search for.
fields
stringA comma separated list of fields to include or exclude (depending on
includeFields
) from the result, null to retrieve all fields.includeFields
bool?true if the fields specified are to be included in the result, false otherwise. Defaults to true.
cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
InvalidateRememberBrowserAsync(string, CancellationToken)
Invalidate all remembered browsers for MFA.
public Task InvalidateRememberBrowserAsync(string id, CancellationToken cancellationToken = default)
Parameters
id
stringThe user_id of the user which will have its remembered browsers for MFA invalidated.
cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
- Task
A Task representing the operation and potential return value.
LinkAccountAsync(string, UserAccountLinkRequest, CancellationToken)
Links a secondary account to a primary account.
public Task<IList<AccountLinkResponse>> LinkAccountAsync(string id, UserAccountLinkRequest request, CancellationToken cancellationToken = default)
Parameters
id
stringThe ID of the primary account.
request
UserAccount Link Request The User
Account containing details of the secondary account to link.Link Request cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
- Task<IList<Account
Link >>Response A IList<T> containing details about this account link.
LinkAccountAsync(string, string, string, CancellationToken)
Links a secondary account to a primary account.
public Task<IList<AccountLinkResponse>> LinkAccountAsync(string id, string primaryJwtToken, string secondaryJwtToken, CancellationToken cancellationToken = default)
Parameters
id
stringThe ID of the primary account.
primaryJwtToken
stringThe JWT of the primary account.
secondaryJwtToken
stringThe JWT for the secondary account you wish to link.
cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
- Task<IList<Account
Link >>Response A IList<T> containing details about this account link.
RemovePermissionsAsync(string, AssignPermissionsRequest, CancellationToken)
Removes permissions assigned to a user.
public Task RemovePermissionsAsync(string id, AssignPermissionsRequest request, CancellationToken cancellationToken = default)
Parameters
id
stringThe ID of the user to remove permissions from.
request
AssignPermissions Request A Assign
Permissions containing the permission identifiers to remove from the user.Request cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
RemoveRolesAsync(string, AssignRolesRequest, CancellationToken)
Removes Roles from a user.
public Task RemoveRolesAsync(string id, AssignRolesRequest request, CancellationToken cancellationToken = default)
Parameters
id
stringThe ID of the user to remove roles from.
request
AssignRoles Request A Assign
Roles containing the role IDs to remove to the user.Request cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
UnlinkAccountAsync(string, string, string, CancellationToken)
Unlinks user accounts
public Task<IList<AccountLinkResponse>> UnlinkAccountAsync(string primaryUserId, string provider, string secondaryUserId, CancellationToken cancellationToken = default)
Parameters
primaryUserId
stringThe ID of the primary account.
provider
stringThe type of the identity provider.
secondaryUserId
stringThe ID for the secondary account.
cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
- Task<IList<Account
Link >>Response A IList<T> containing details about this account link.
UpdateAsync(string, UserUpdateRequest, CancellationToken)
Updates a user.
public Task<User> UpdateAsync(string id, UserUpdateRequest request, CancellationToken cancellationToken = default)
Parameters
id
stringThe id of the user to update.
request
UserUpdate Request The User
Update containing the information you wish to update.Request cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
UpdateAuthenticationMethodAsync(string, string, AuthenticationMethodUpdateRequest, CancellationToken)
Update an authentication methods.
public Task<AuthenticationMethod> UpdateAuthenticationMethodAsync(string userId, string authenticationMethodId, AuthenticationMethodUpdateRequest request, CancellationToken cancellationToken = default)
Parameters
userId
stringThe ID of the user for which you want to update the authentication methods
authenticationMethodId
stringThe ID of the authentication method you want to update.
request
AuthenticationMethod Update Request The Authentication
Method containing the properties of the authentication methods to update.Update Request cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
- Task<Authentication
Method > The updated Authentication
Method .
UpdateAuthenticationMethodsAsync(string, IList<AuthenticationMethodsUpdateRequest>, CancellationToken)
Updates all authentication methods by replacing them with the given ones.
public Task<IList<AuthenticationMethod>> UpdateAuthenticationMethodsAsync(string userId, IList<AuthenticationMethodsUpdateRequest> request, CancellationToken cancellationToken = default)
Parameters
userId
stringThe ID of the user for which you want to update the authentication methods.
request
IList<AuthenticationMethods >Update Request The Authentication
Methods containing the properties of the authentication methods to update.Update Request cancellationToken
CancellationToken The cancellation token to cancel operation.
Returns
- Task<IList<Authentication
Method >> The updated list of Authentication
Method .