Auth0-PHP

Users extends ManagementEndpoint
in package
implements UsersInterface

Class Users.

Handles requests to the Users endpoint of the v2 Management API.

Tags
see
https://auth0.com/docs/api/management/v2#!/Users

Interfaces, Classes, Traits and Enums

UsersInterface
Interface UsersInterface.

Table of Contents

$httpClient  : HttpClient
__construct()  : mixed
ManagementEndpoint constructor.
addPermissions()  : ResponseInterface
Add one or more permissions to a specific user.
addRoles()  : ResponseInterface
Add one or more roles to a specific user.
create()  : ResponseInterface
Create a new user for a given database or passwordless connection.
createRecoveryCode()  : ResponseInterface
Remove the current multi-factor authentication recovery code and generate a new one.
delete()  : ResponseInterface
Delete a User by ID.
deleteMultifactorProvider()  : ResponseInterface
Delete the multifactor provider settings for a particular user.
get()  : ResponseInterface
Get a User.
getAll()  : ResponseInterface
Search all Users.
getEnrollments()  : ResponseInterface
Retrieve the first confirmed Guardian enrollment for a user.
getHttpClient()  : HttpClient
Get the injected HttpClient instance.
getLastRequest()  : HttpRequest|null
Return an instance of HttpRequest representing the last issued request.
getLogs()  : ResponseInterface
Get log entries for a specific user.
getOrganizations()  : ResponseInterface
Get organizations a specific user belongs to.
getPermissions()  : ResponseInterface
Get all permissions for a specific user.
getResponsePaginator()  : HttpResponsePaginator
Return a ResponsePaginator instance configured for the last HttpRequest.
getRoles()  : ResponseInterface
Get all roles assigned to a specific user.
instance()  : static
invalidateBrowsers()  : ResponseInterface
Invalidate all remembered browsers across all authentication factors for a user.
linkAccount()  : ResponseInterface
Link one user identity to another.
removePermissions()  : ResponseInterface
Remove one or more permissions from a specific user.
removeRoles()  : ResponseInterface
Remove one or more roles from a specific user.
unlinkAccount()  : ResponseInterface
Unlink an identity from the target user.
update()  : ResponseInterface
Update a User.

Properties

Methods

__construct()

ManagementEndpoint constructor.

public final __construct(HttpClient $httpClient) : mixed
Parameters
$httpClient : HttpClient

httpClient instance to use

Return values
mixed

addPermissions()

Add one or more permissions to a specific user.

public addPermissions(string $id, array<string|int, mixed> $permissions[, RequestOptions|null $options = null ]) : ResponseInterface

Required scope: update:users.

Parameters
$id : string

user ID to add permissions to

$permissions : array<string|int, mixed>
$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Return values
ResponseInterface

addRoles()

Add one or more roles to a specific user.

public addRoles(string $id, array<string|int, mixed> $roles[, RequestOptions|null $options = null ]) : ResponseInterface

Required scopes:

  • update:users
  • read:roles.
Parameters
$id : string

user ID to add roles to

$roles : array<string|int, mixed>

array of roles to add

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Return values
ResponseInterface

create()

Create a new user for a given database or passwordless connection.

public create(string $connection, array<string|int, mixed> $body[, RequestOptions|null $options = null ]) : ResponseInterface

Required scope: create:users.

Parameters
$connection : string

connection (by ID) to use for the new User

$body : array<string|int, mixed>

Configuration for the new User. Some parameters are dependent upon the type of connection. See @see for supported options.

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Return values
ResponseInterface

createRecoveryCode()

Remove the current multi-factor authentication recovery code and generate a new one.

public createRecoveryCode(string $id[, RequestOptions|null $options = null ]) : ResponseInterface

Required scope: update:users.

Parameters
$id : string

user ID of the user to regenerate a multi-factor authentication recovery code for

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Return values
ResponseInterface

delete()

Delete a User by ID.

public delete(string $id[, RequestOptions|null $options = null ]) : ResponseInterface

Required scope: delete:users.

Parameters
$id : string

user ID to delete

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Return values
ResponseInterface

deleteMultifactorProvider()

Delete the multifactor provider settings for a particular user.

public deleteMultifactorProvider(string $id, string $provider[, RequestOptions|null $options = null ]) : ResponseInterface

This will force user to re-configure the multifactor provider. Required scope: update:users.

Parameters
$id : string

user ID with the multifactor provider to delete

$provider : string

multifactor provider to delete

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Return values
ResponseInterface

get()

Get a User.

public get(string $id[, RequestOptions|null $options = null ]) : ResponseInterface

Required scopes:

  • read:users for any call to this endpoint.
  • read:user_idp_tokens to retrieve the "access_token" field for logged-in identities.
Parameters
$id : string

user (by their ID) to query

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Return values
ResponseInterface

getAll()

Search all Users.

public getAll([array<string|int, mixed>|null $parameters = null ][, RequestOptions|null $options = null ]) : ResponseInterface

Required scopes:

  • read:users for any call to this endpoint.
  • read:user_idp_tokens to retrieve the "access_token" field for logged-in identities.
Parameters
$parameters : array<string|int, mixed>|null = null

Optional. Query parameters to pass with the API request. See @see for supported options.

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Return values
ResponseInterface

getEnrollments()

Retrieve the first confirmed Guardian enrollment for a user.

public getEnrollments(string $id[, RequestOptions|null $options = null ]) : ResponseInterface

Required scope: read:users.

Parameters
$id : string

user ID to query

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Return values
ResponseInterface

getLogs()

Get log entries for a specific user.

public getLogs(string $id[, RequestOptions|null $options = null ]) : ResponseInterface

Required scope: read:logs.

Parameters
$id : string

user ID to get logs entries for

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Return values
ResponseInterface

getOrganizations()

Get organizations a specific user belongs to.

public getOrganizations(string $id[, RequestOptions|null $options = null ]) : ResponseInterface

Required scope: read:organizations.

Parameters
$id : string

user ID to get organization entries for

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Return values
ResponseInterface

getPermissions()

Get all permissions for a specific user.

public getPermissions(string $id[, RequestOptions|null $options = null ]) : ResponseInterface

Required scope: read:users.

Parameters
$id : string

user ID to get permissions for

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Return values
ResponseInterface

getRoles()

Get all roles assigned to a specific user.

public getRoles(string $id[, RequestOptions|null $options = null ]) : ResponseInterface

Required scopes:

  • read:users
  • read:roles.
Parameters
$id : string

user ID to get roles for

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Return values
ResponseInterface

invalidateBrowsers()

Invalidate all remembered browsers across all authentication factors for a user.

public invalidateBrowsers(string $id[, RequestOptions|null $options = null ]) : ResponseInterface

Required scope: update:users.

Parameters
$id : string

user ID of the user to invalidate all remembered browsers and authentication factors for

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Return values
ResponseInterface

linkAccount()

Link one user identity to another.

public linkAccount(string $id, array<string|int, mixed> $body[, RequestOptions|null $options = null ]) : ResponseInterface

Required scope: update:users.

Parameters
$id : string

user ID of the primary account

$body : array<string|int, mixed>

additional body content to send with the API request

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Return values
ResponseInterface

removePermissions()

Remove one or more permissions from a specific user.

public removePermissions(string $id, array<string|int, mixed> $permissions[, RequestOptions|null $options = null ]) : ResponseInterface

Required scope: update:users.

Parameters
$id : string

user ID to remove permissions from

$permissions : array<string|int, mixed>
$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Return values
ResponseInterface

removeRoles()

Remove one or more roles from a specific user.

public removeRoles(string $id, array<string|int, mixed> $roles[, RequestOptions|null $options = null ]) : ResponseInterface

Required scope: update:users.

Parameters
$id : string

user ID to remove roles from

$roles : array<string|int, mixed>

array of permissions to remove

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Return values
ResponseInterface

unlinkAccount()

Unlink an identity from the target user.

public unlinkAccount(string $id, string $provider, string $identityId[, RequestOptions|null $options = null ]) : ResponseInterface

Required scope: update:users.

Parameters
$id : string

user ID of the primary user account

$provider : string

Identity provider name of the secondary linked account (e.g. google-oauth2).

$identityId : string

ID of the secondary linked account

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Return values
ResponseInterface

update()

Update a User.

public update(string $id, array<string|int, mixed> $body[, RequestOptions|null $options = null ]) : ResponseInterface

Required scopes:

  • update:users for any call to this endpoint.
  • update:users_app_metadata for any update that includes "user_metadata" or "app_metadata" fields.
Parameters
$id : string

user (by their ID) to update

$body : array<string|int, mixed>

User data to update. See @see for supported options.

$options : RequestOptions|null = null

Optional. Additional request options to use, such as a field filtering or pagination. (Not all endpoints support these. See @see for supported options.)

Return values
ResponseInterface

Search results