The Auth0 Laravel SDK provides easy-to-use methods to access Auth0's Management API endpoints. Nearly every endpoint of the Management API is available to use with your Laravel application. For more information about any of these endpoints, see the Management API Explorer.
The Management API class can be accessed through the management()
method on the Auth0 Laravel SDK service. You can pull the Auth0 SDK instance from the Laravel service container using dependency injection, or use the Auth0
facade. Once you have an instance, you can call any of the available endpoints.
use Auth0\Laravel\Facade\Auth0;
Auth0::management();
Before making Management API calls you must permit your application to communicate with the Management API. This can be done from the Auth0 Dashboard's API page, choosing Auth0 Management API
, and selecting the 'Machine to Machine Applications' tab. Authorize your Laravel application, and then click the down arrow to choose the scopes you wish to grant.
- Actions
- Attack Protection
- Blacklists
- ClientGrants
- Clients
- Connections
- Device Credentials
- Emails
- Email Templates
- Grants
- Guardian
- Jobs
- Logs
- Log Streams
- Organizations
- Resource Servers
- Roles
- Rules
- Stats
- Tenants
- Tickets
- User Blocks
- Users
- Users by Email
The /api/v2/actions endpoint class is accessible from the actions()
method on the Management API class.
Method | Endpoint | SDK Method |
---|---|---|
GET |
…/actions/actions | getAll() |
POST |
…/actions/actions | create(body: []) |
GET |
…/actions/actions/{id} | get(id: '...') |
PATCH |
…/actions/actions/{id} | update(id: '...', body: []) |
DELETE |
…/actions/actions/{id} | delete(id: '...') |
POST |
…/actions/actions/{id}/test | test(id: '...') |
POST |
…/actions/actions/{id}/deploy | deploy(id: '...') |
GET |
…/actions/actions/{actionId}/versions | getVersions(actionId: '...') |
GET |
…/actions/actions/{actionId}/versions/{id} | getVersion(id: '...', actionId: '...') |
POST |
…/actions/actions/{actionId}/versions/{id}/deploy | rollbackVersion(id: '...', actionId: '...') |
GET |
…/actions/executions/{id} | getExecution(id: '...') |
GET |
…/actions/triggers | getTriggers() |
GET |
…/actions/triggers/{triggerId}/bindings | getTriggerBindings(triggerId: '...') |
PATCH |
…/actions/triggers/{triggerId}/bindings | updateTriggerBindings(triggerId: '...', body: []) |
For full usage reference of the available API methods please review the Auth0\SDK\API\Management\Actions class.
use Auth0\SDK\Utility\HttpResponse;
$management = app('auth0')->management();
$actions = $management->actions();
// Retrieves the first batch of results results.
$results = $actions->getAll();
// You can then iterate (and auto-paginate) through all available results.
foreach ($actions->getResponsePaginator() as $action) {
// Do something with the action.
}
The /api/v2/attack-protection endpoint class is accessible from the attackProtection()
method on the Management API class.
Method | Endpoint | SDK Method |
---|---|---|
GET |
…/attack-protection/breached-password-detection | getBreachedPasswordDetection() |
PATCH |
…/attack-protection/breached-password-detection | updateBreachedPasswordDetection(body: []) |
GET |
…/attack-protection/brute-force-protection | getBruteForceProtection() |
PATCH |
…/attack-protection/brute-force-protection | updateBruteForceProtection(body: []) |
GET |
…/attack-protection/suspicious-ip-throttling | getSuspiciousIpThrottling() |
PATCH |
…/attack-protection/suspicious-ip-throttling | updateSuspiciousIpThrottling(body: []) |
For full usage reference of the available API methods please review the Auth0\SDK\API\Management\AttackProtection class.
use Auth0\SDK\Utility\HttpResponse;
$management = app('auth0')->management();
$attackProtection = $management->attackProtection();
// Get the current configuration.
$response = $attackProtection->getBreachedPasswordDetection();
// Print the response body.
dd(HttpResponse::decode($response));
// {
// "enabled": true,
// "shields": [
// "block",
// "admin_notification"
// ],
// "admin_notification_frequency": [
// "immediately",
// "weekly"
// ],
// "method": "standard",
// "stage": {
// "pre-user-registration": {
// "shields": [
// "block",
// "admin_notification"
// ]
// }
// }
// }
The /api/v2/blacklists endpoint class is accessible from the blacklists()
method on the Management API class.
Method | Endpoint | SDK Method |
---|---|---|
GET |
…/blacklists/tokens | get() |
POST |
…/blacklists/tokens | create(jti: '...') |
For full usage reference of the available API methods please review the Auth0\SDK\API\Management\Blacklists class.
use Auth0\SDK\Utility\HttpResponse;
$management = app('auth0')->management();
$blacklists = $management->blacklists();
$response = $blacklists->create('some-jti');
if ($response->getStatusCode() === 201) {
// Token was successfully blacklisted.
// Retrieve all blacklisted tokens.
$results = $blacklists->get();
// You can then iterate (and auto-paginate) through all available results.
foreach ($blacklists->getResponsePaginator() as $blacklistedToken) {
// Do something with the blacklisted token.
}
// Or, just work with the initial batch from the response.
dd(HttpResponse::decode($results));
// [
// {
// "aud": "...",
// "jti": "some-jti"
// }
// ]
}
The /api/v2/client-grants endpoint class is accessible from the clientGrants()
method on the Management API class.
Method | Endpoint | SDK Method |
---|---|---|
GET |
…/client-grants | getAll() |
GET |
…/client-grants | getAllByAudience(audience: '...') |
GET |
…/client-grants | getAllByClientId(clientId: '...') |
POST |
…/client-grants | create(clientId: '...', audience: '...') |
PATCH |
…/client-grants/{id} | update(grantId: '...') |
DELETE |
…/client-grants/{id} | delete(grantId: '...') |
For full usage reference of the available API methods please review the Auth0\SDK\API\Management\ClientGrants class.
use Auth0\SDK\Utility\HttpResponse;
$management = app('auth0')->management();
$clientGrants = $management->clientGrants();
// Retrieves the first batch of results results.
$results = $clientGrants->getAll();
// You can then iterate (and auto-paginate) through all available results.
foreach ($clientGrants->getResponsePaginator() as $clientGrant) {
// Do something with the client grant.
}
// Or, just work with the initial batch from the response.
dd(HttpResponse::decode($results));
// [
// {
// "id": "",
// "client_id": "",
// "audience": "",
// "scope": [
// ""
// ]
// }
// ]
The /api/v2/clients endpoint class is accessible from the clients()
method on the Management API class.
Method | Endpoint | SDK Method |
---|---|---|
GET |
…/clients | getAll() |
POST |
…/clients | create(name: '...') |
GET |
…/clients/{id} | get(id: '...') |
PATCH |
…/clients/{id} | update(id: '...') |
DELETE |
…/clients/{id} | delete(id: '...') |
For full usage reference of the available API methods please review the Auth0\SDK\API\Management\Clients class.
use Auth0\SDK\Utility\HttpResponse;
$management = app('auth0')->management();
$clients = $management->clients();
// Retrieves the first batch of results results.
$results = $clients->getAll();
// You can then iterate (and auto-paginate) through all available results.
foreach ($clients->getResponsePaginator() as $client) {
// Do something with the client.
}
// Or, just work with the initial batch from the response.
dd(HttpResponse::decode($results));
// [
// {
// "client_id": "",
// "tenant": "",
// "name": "",
// ...
// }
// ]
The /api/v2/connections endpoint class is accessible from the connections()
method on the Management API class.
Method | Endpoint | SDK Method |
---|---|---|
GET |
…/connections | getAll() |
POST |
…/connections | create(name: '...', strategy: '...') |
GET |
…/connections/{id} | get(id: '...') |
PATCH |
…/connections/{id} | update(id: '...') |
DELETE |
…/connections/{id} | delete(id: '...') |
DELETE |
…/connections/{id}/users | deleteUser(id: '...', email: '...') |
For full usage reference of the available API methods please review the Auth0\SDK\API\Management\Connections class.
use Auth0\SDK\Utility\HttpResponse;
$management = app('auth0')->management();
$connections = $management->connections();
// Retrieves the first batch of results results.
$results = $connections->getAll();
// You can then iterate (and auto-paginate) through all available results.
foreach ($connections->getResponsePaginator() as $connection) {
// Do something with the connection.
}
// Or, just work with the initial batch from the response.
dd(HttpResponse::decode($results));
// [
// {
// "name": "",
// "display_name": "",
// "options": {},
// "id": "",
// "strategy": "",
// "realms": [
// ""
// ],
// "is_domain_connection": false,
// "metadata": {}
// }
// ]
The /api/v2/device-credentials endpoint class is accessible from the deviceCredentials()
method on the Management API class.
Method | Endpoint | SDK Method |
---|---|---|
GET |
…/device-credentials | get(userId: '...') |
POST |
…/device-credentials | create(deviceName: '...', type: '...', value: '...', deviceId: '...') |
DELETE |
…/device-credentials/{id} | delete(id: '...') |
For full usage reference of the available API methods please review the Auth0\SDK\API\Management\DeviceCredentials class.
use Auth0\SDK\Utility\HttpResponse;
$management = app('auth0')->management();
$deviceCredentials = $management->deviceCredentials();
// Retrieves the first batch of results results.
$results = $deviceCredentials->get('user_id');
// You can then iterate (and auto-paginate) through all available results.
foreach ($deviceCredentials->getResponsePaginator() as $deviceCredential) {
// Do something with the device credential.
}
// Or, just work with the initial batch from the response.
dd(HttpResponse::decode($results));
// [
// {
// "id": "",
// "device_name": "",
// "device_id": "",
// "type": "",
// "user_id": "",
// "client_id": ""
// }
// ]
The /api/v2/emails endpoint class is accessible from the emails()
method on the Management API class.
Method | Endpoint | SDK Method |
---|---|---|
GET |
…/emails/provider | getProvider() |
POST |
…/emails/provider | createProvider(name: '...', credentials: []) |
PATCH |
…/emails/provider | updateProvider(name: '...', credentials: []) |
DELETE |
…/emails/provider | deleteProvider() |
For full usage reference of the available API methods please review the Auth0\SDK\API\Management\Emails class.
use Auth0\SDK\Utility\HttpResponse;
$management = app('auth0')->management();
$endpoint = $management->emails();
// Configure the email provider.
$endpoint->createProvider(
name: 'smtp',
credentials: [
'smtp_host' => '...',
'smtp_port' => 587,
'smtp_user' => '...',
'smtp_pass' => '...',
],
body: [
'enabled' => true,
'default_from_address' => '[email protected]',
]
)
// Retrieves the configuration of the email provider.
$provider = $endpoint->getProvider();
// Print the configuration.
dd(HttpResponse::decode($provider));
// {
// "name": "smtp",
// "enabled": true,
// "default_from_address": "[email protected]",
// "credentials": {
// 'smtp_host' => '...',
// 'smtp_port' => 587,
// 'smtp_user' => '...',
// 'smtp_pass' => '...',
// },
// "settings": {}
// }
The /api/v2/email-templates endpoint class is accessible from the emailTemplates()
method on the Management API class.
Method | Endpoint | SDK Method |
---|---|---|
POST |
…/email-templates | create(template: '...', body: '...', from: '...', subject: '...', syntax: '...', enabled: true) |
GET |
…/email-templates/{templateName} | get(templateName: '...') |
PATCH |
…/email-templates/{templateName} | update(templateName: '...', body: []) |
PUT |
…/email-templates/{templateName} | update(templateName: '...', body: []) |
For full usage reference of the available API methods please review the Auth0\SDK\API\Management\EmailTemplates class.
use Auth0\SDK\Utility\HttpResponse;
$management = app('auth0')->management();
$templates = $management->emailTemplates();
// Create a new email template.
$templates->create(
template: 'verify_email',
body: '...',
from: '[email protected]',
subject: '...',
syntax: 'liquid',
enabled: true,
);
// Retrieves the configuration of the email template.
$template = $templates->get(templateName: 'verify_email');
// Print the configuration.
dd(HttpResponse::decode($template));
// {
// "template": "verify_email",
// "body": "",
// "from": "[email protected]",
// "resultUrl": "",
// "subject": "",
// "syntax": "liquid",
// "urlLifetimeInSeconds": 0,
// "includeEmailInRedirect": false,
// "enabled": false
// }
The /api/v2/grants endpoint class is accessible from the grants()
method on the Management API class.
Method | Endpoint | SDK Method |
---|---|---|
GET |
…/grants | getAll() |
GET |
…/grants | getAllByAudience(audience: '...') |
GET |
…/grants | getAllByClientId(clientId: '...') |
GET |
…/grants | getAllByUserId(userId: '...') |
DELETE |
…/grants/{id} | delete(id: '...') |
For full usage reference of the available API methods please review the Auth0\SDK\API\Management\Grants class.
use Auth0\SDK\Utility\HttpResponse;
$management = app('auth0')->management();
$grants = $management->grants();
// Retrieves the first batch of grant results.
$results = $grants->getAll();
// You can then iterate (and auto-paginate) through all available results.
foreach ($grants->getResponsePaginator() as $grant) {
// Do something with the device credential.
}
// Or, just work with the initial batch from the response.
dd(HttpResponse::decode($results));
// [
// {
// "id": "...",
// "clientID": "...",
// "user_id": "...",
// "audience": "...",
// "scope": [
// "..."
// ],
// }
// ]
The /api/v2/guardian endpoint class is accessible from the guardian()
method on the Management API class.
Method | Endpoint | SDK Method |
---|---|---|
GET |
…/guardian/enrollments/{id} | getEnrollment(id: '...') |
DELETE |
…/guardian/enrollments/{id} | deleteEnrollment(id: '...') |
GET |
…/guardian/factors | getFactors() |
For full usage reference of the available API methods please review the Auth0\SDK\API\Management\Guardian class.
use Auth0\SDK\Utility\HttpResponse;
$management = app('auth0')->management();
$guardian = $management->guardian();
// Retrieves the first batch of factor results.
$results = $guardian->getFactors();
// You can then iterate (and auto-paginate) through all available results.
foreach ($guardian->getResponsePaginator() as $factor) {
// Do something with the device credential.
dump($factor);
// {
// "enabled": true,
// "trial_expired": true,
// "name": "..."
// }
}
// Or, just work with the initial batch from the response.
dd(HttpResponse::decode($results));
// [
// {
// "enabled": true,
// "trial_expired": true,
// "name": "..."
// }
// ]
The /api/v2/jobs endpoint class is accessible from the jobs()
method on the Management API class.
Method | Endpoint | SDK Method |
---|---|---|
GET |
…/jobs/{id} | get(id: '...') |
GET |
…/jobs/{id}/errors | getErrors(id: '...') |
POST |
…/jobs/users-exports | createExportUsersJob(body: []) |
POST |
…/jobs/users-imports | createImportUsers(filePath: '...', connectionId: '...') |
POST |
…/jobs/verification-email | createSendVerificationEmail(userId: '...') |
For full usage reference of the available API methods please review the Auth0\SDK\API\Management\Jobs class.
use Auth0\SDK\Utility\HttpResponse;
$management = app('auth0')->management();
$connections = $management->connections();
$jobs = $management->jobs();
// Create a connection.
$connection = $connections->create([
'name' => 'Test Connection',
'strategy' => 'auth0',
]);
if (! HttpResponse::wasSuccessful($job)) {
throw new \Exception('Connection creation failed.');
}
$connection = HttpResponse::decode($connection);
// Create a new user export job.
$response = $jobs->createExportUsersJob([
'format' => 'json',
'fields' => [
['name' => 'user_id'],
['name' => 'name'],
['name' => 'email'],
['name' => 'identities[0].connection', "export_as": "provider"],
['name' => 'user_metadata.some_field'],
],
'connection_id' => $connection['id'],
]);
if ($response->getStatusCode() === 201) {
// The job was created successfully. Retrieve it's ID.
$jobId = HttpResponse::decode($response)['id'];
$job = null;
while (true) {
// Get the job status.
$job = $jobs->get($jobId);
if (! HttpResponse::wasSuccessful($job)) {
$job = null;
break;
}
$job = HttpResponse::decode($job);
// If the job is complete, break out of the loop.
if ($job['status'] === 'completed') {
break;
}
// If the job has failed, break out of the loop.
if ($job['status'] === 'failed') {
$job = null
break;
}
// Wait 1 second before checking the job status again.
sleep(1);
}
if ($job === null) {
// The job failed.
$errors = $jobs->getErrors($jobId);
dd($errors);
}
// The job completed successfully. Do something with the job.
dd($job);
// Delete the connection.
$connections->delete($connection['id']);
}
The /api/v2/logs endpoint class is accessible from the logs()
method on the Management API class.
Method | Endpoint | SDK Method |
---|---|---|
GET |
…/logs | getAll() |
GET |
…/logs/{id} | get(id: '...') |
For full usage reference of the available API methods please review the Auth0\SDK\API\Management\Logs class.
use Auth0\SDK\Utility\HttpResponse;
$management = app('auth0')->management();
$logs = $management->logs();
// Retrieves the first batch of log results.
$results = $logs->getAll();
// You can then iterate (and auto-paginate) through all available results.
foreach ($logs->getResponsePaginator() as $log) {
// Do something with the log.
dump($log);
// {
// "date": "...",
// "type": "...",
// "description": "..."
// }
}
// Or, just work with the initial batch from the response.
dd(HttpResponse::decode($results));
// [
// {
// "date": "...",
// "type": "...",
// "description": "..."
// }
// ]
The /api/v2/log-streams endpoint class is accessible from the logStreams()
method on the Management API class.
Method | Endpoint | SDK Method |
---|---|---|
GET |
…/log-streams | getAll() |
POST |
…/log-streams | create(type: '...', sink: '...') |
GET |
…/log-streams/{id} | get(id: '...') |
PATCH |
…/log-streams/{id} | update(id: '...', body: []) |
DELETE |
…/log-streams/{id} | delete(id: '...') |
For full usage reference of the available API methods please review the Auth0\SDK\API\Management\LogStreams class.
use Auth0\SDK\Utility\HttpResponse;
$management = app('auth0')->management();
$logStreams = $management->logStreams();
// Create a new log stream.
$logStreams->create(
type: '...',
sink: [
'name' => '...',
]
);
// Get the first batch of log streams.
$results = $logStreams->getAll();
// You can then iterate (and auto-paginate) through all available results.
foreach ($logStreams->getResponsePaginator() as $logStream) {
// Do something with the log stream.
dump($logStream);
// {
// "id": "...",
// "name": "...",
// "type": "...",
// "status": "..."
// }
}
// Or, just work with the initial batch from the response.
dd(HttpResponse::decode($results));
// [
// {
// "id": "...",
// "name": "...",
// "type": "...",
// "status": "..."
// }
// ]
The /api/v2/organizations endpoint class is accessible from the organizations()
method on the Management API class.
Method | Endpoint | SDK Method |
---|---|---|
GET |
…/organizations | getAll() |
POST |
…/organizations | create(name: '...', displayName: '...') |
GET |
…/organizations/{id} | get(id: '...') |
PATCH |
…/organizations/{id} | update(id: '...', name: '...', displayName: '...') |
DELETE |
…/organizations/{id} | delete(id: '...') |
GET |
…/organizations/name/{name} | getByName(name: '...') |
GET |
…/organizations/{id}/members | getMembers(id: '...') |
POST |
…/organizations/{id}/members | addMembers(id: '...', members: []) |
DELETE |
…/organizations/{id}/members | removeMembers(id: '...', members: []) |
GET |
…/organizations/{id}/invitations | getInvitations(id: '...') |
POST |
…/organizations/{id}/invitations | createInvitation(id: '...', clientId: '...', inviter: '...', invitee: '...') |
GET |
…/organizations/{id}/invitations/{invitationId} | getInvitation(id: '...', invitationId: '...') |
DELETE |
…/organizations/{id}/invitations/{invitationId} | deleteInvitation(id: '...', invitationId: '...') |
GET |
…/organizations/{id}/enabled_connections | getEnabledConnections(id: '...') |
POST |
…/organizations/{id}/enabled_connections | addEnabledConnection(id: '...', connectionId: '...', body: []) |
GET |
…/organizations/{id}/enabled_connections/{connectionId} | getEnabledConnection(id: '...', connectionId: '...') |
PATCH |
…/organizations/{id}/enabled_connections/{connectionId} | updateEnabledConnection(id: '...' connectionId: '...', body: []) |
DELETE |
…/organizations/{id}/enabled_connections/{connectionId} | removeEnabledConnection(id: '...', connectionId: '...') |
GET |
…/organizations/{id}/members/{userId}/roles | getMemberRoles(id: '...'. userId: '...') |
POST |
…/organizations/{id}/members/{userId}/roles | addMemberRoles(id: '...'. userId: '...', roles: []) |
DELETE |
…/organizations/{id}/members/{userId}/roles | removeMemberRoles(id: '...'. userId: '...', roles: []) |
For full usage reference of the available API methods please review the Auth0\SDK\API\Management\Organizations class.
use Auth0\SDK\Utility\HttpResponse;
$management = app('auth0')->management();
$organizations = $management->organizations();
// Get all organizations.
$results = $organizations->getAll();
// You can then iterate (and auto-paginate) through all available results.
foreach ($logStreams->getResponsePaginator() as $logStream) {
// Do something with the log stream.
dump($logStream);
// {
// "id": "",
// "name": "...",
// "display_name": "...",
// }
}
// Or, just work with the initial batch from the response.
dd(HttpResponse::decode($results));
// [
// {
// "id": "",
// "name": "...",
// "display_name": "...",
// ]
// Get a single organization.
$results = $organizations->get('org_id');
// Create a new organization.
$results = $organizations->create('name', 'display_name');
// Update an existing organization.
$results = $organizations->update('org_id', 'name', 'display_name');
// Delete an organization.
$results = $organizations->delete('org_id');
// Get all members of an organization.
$results = $organizations->getMembers('org_id');
// Add members to an organization.
$results = $organizations->addMembers('org_id', ['user_id_1', 'user_id_2']);
// Remove members from an organization.
$results = $organizations->removeMembers('org_id', ['user_id_1', 'user_id_2']);
// Get all invitations for an organization.
$results = $organizations->getInvitations('org_id');
// Create a new invitation for an organization.
$results = $organizations->createInvitation('org_id', 'client_id', 'inviter_user_id', 'invitee_email');
// Get a single invitation for an organization.
$results = $organizations->getInvitation('org_id', 'invitation_id');
// Delete an invitation for an organization.
$results = $organizations->deleteInvitation('org_id', 'invitation_id');
// Get all enabled connections for an organization.
$results = $organizations->getEnabledConnections('org_id');
// Add a connection to an organization.
$results = $organizations->addEnabledConnection('org_id', 'connection_id', ['assign_membership_on_login' => true]);
// Get a single enabled connection for an organization.
$results = $organizations->getEnabledConnection('org_id', 'connection_id');
// Update an enabled connection for an organization.
$results = $organizations->updateEnabledConnection('org_id', 'connection_id', ['assign_membership_on_login' => false]);
// Remove a connection from an organization.
$results = $organizations->removeEnabledConnection('org_id', 'connection_id');
// Get all roles for a member of an organization.
$results = $organizations->getMemberRoles('org_id', 'user_id');
// Add roles to a member of an organization.
$results = $organizations->addMemberRoles('org_id', 'user_id', ['role_id_1', 'role_id_2']);
// Remove roles from a member of an organization.
$results = $organizations->removeMemberRoles('org_id', 'user_id', ['role_id_1', 'role_id_2']);
The /api/v2/resource-servers endpoint class is accessible from the resourceServers()
method on the Management API class.
Method | Endpoint | PHP Method |
---|---|---|
GET |
…/resource-servers | getAll() |
POST |
…/resource-servers | create(identifier: '...', body: []) |
GET |
…/resource-servers/{id} | get(id: '...') |
PATCH |
…/resource-servers/{id} | update(id: '...', body: '...') |
DELETE |
…/resource-servers/{id} | delete(id: '...') |
For full usage reference of the available API methods please review the Auth0\SDK\API\Management\ResourceServers class.
use Auth0\SDK\Utility\HttpResponse;
$management = app('auth0')->management();
$resourceServers = $management->resourceServers();
// Create a new resource server.
$resourceServers->create(
identifier: 'https://my-resource-server.auth0.com',
body: [
'name' => 'My Example API',
'scopes' => [
[
'value' => 'read:messages',
'description' => 'Read messages',
],
[
'value' => 'write:messages',
'description' => 'Write messages',
],
],
]
);
// Get all resource servers.
$results = $resourceServers->getAll();
// You can then iterate (and auto-paginate) through all available results.
foreach ($logStreams->getResponsePaginator() as $logStream) {
// Do something with the log stream.
dump($logStream);
// {
// "id": "",
// "name": "",
// "is_system": false,
// "identifier": "",
// "scopes": [
// "object"
// ],
// "signing_alg": "",
// "signing_secret": "",
// "allow_offline_access": false,
// "skip_consent_for_verifiable_first_party_clients": false,
// "token_lifetime": 0,
// "token_lifetime_for_web": 0,
// "enforce_policies": false,
// "token_dialect": "",
// "client": {}
// }
}
// Or, just work with the initial batch from the response.
dd(HttpResponse::decode($results));
// [
// {
// "id": "",
// "name": "",
// "is_system": false,
// "identifier": "",
// "scopes": [
// "object"
// ],
// "signing_alg": "",
// "signing_secret": "",
// "allow_offline_access": false,
// "skip_consent_for_verifiable_first_party_clients": false,
// "token_lifetime": 0,
// "token_lifetime_for_web": 0,
// "enforce_policies": false,
// "token_dialect": "",
// "client": {}
// }
// ]
The /api/v2/roles endpoint class is accessible from the roles()
method on the Management API class.
Method | Endpoint | PHP Method |
---|---|---|
GET |
…/roles | getAll() |
POST |
…/roles | create(name: '...', body: []) |
GET |
…/roles/{id} | get(id: '...') |
PATCH |
…/roles/{id} | update(id: '...', body: []) |
DELETE |
…/roles/{id} | delete(id: '...') |
GET |
…/roles/{id}/users | getUsers(id: '...') |
POST |
…/roles/{id}/users | addUsers(id: '...', users: []) |
GET |
…/roles/{id}/permissions | getPermissions(id: '...') |
POST |
…/roles/{id}/permissions | addPermissions(id: '...', permissions: []) |
DELETE |
…/roles/{id}/permissions | removePermissions(id: '...', permissions: []) |
For full usage reference of the available API methods please review the Auth0\SDK\API\Management\Roles class.
use Auth0\SDK\Utility\HttpResponse;
$management = app('auth0')->management();
$roles = $management->roles();
// Create a new role.
$roles->create(
name: 'My Example Role',
body: [
'description' => 'This is an example role.',
]
);
// Get all roles.
$results = $roles->getAll();
// You can then iterate (and auto-paginate) through all available results.
foreach ($logStreams->getResponsePaginator() as $logStream) {
// Do something with the log stream.
dump($logStream);
// {
// "id": "",
// "name": "",
// "description": "",
// }
}
// Or, just work with the initial batch from the response.
dd(HttpResponse::decode($results));
// [
// {
// "id": "",
// "name": "",
// "description": "",
// }
// ]
The /api/v2/rules endpoint class is accessible from the rules()
method on the Management API class.
Method | Endpoint | PHP Method |
---|---|---|
GET |
…/rules | getAll() |
POST |
…/rules | create(name: '...', script: '...') |
GET |
…/rules/{id} | get(id: '...') |
PATCH |
…/rules/{id} | update(id: '...', body: []) |
DELETE |
…/rules/{id} | delete(id: '...') |
For full usage reference of the available API methods please review the Auth0\SDK\API\Management\Rules class.
use Auth0\SDK\Utility\HttpResponse;
$management = app('auth0')->management();
$rules = $management->rules();
// Create a new rule.
$rules->create(
name: 'My Example Rule',
script: 'function (user, context, callback) { callback(null, user, context); }'
);
// Get all rules.
$results = $rules->getAll();
// You can then iterate (and auto-paginate) through all available results.
foreach ($logStreams->getResponsePaginator() as $logStream) {
// Do something with the log stream.
dump($logStream);
// {
// "id": "",
// "name": "",
// "script": "",
// "enabled": true,
// "order": 0,
// "stage": "login_success",
// }
}
// Or, just work with the initial batch from the response.
dd(HttpResponse::decode($results));
// [
// {
// "id": "",
// "name": "",
// "script": "",
// "enabled": true,
// "order": 0,
// "stage": "login_success",
// }
// ]
The /api/v2/stats endpoint class is accessible from the stats()
method on the Management API class.
Method | Endpoint | PHP Method |
---|---|---|
GET |
…/stats/active-users | getActiveUsers() |
GET |
…/stats/daily | getDaily(from: '...', to: '...) |
For full usage reference of the available API methods please review the Auth0\SDK\API\Management\Stats class.
use Auth0\SDK\Utility\HttpResponse;
$management = app('auth0')->management();
$stats = $management->stats();
// Retrieve the number of logins, signups and breached-password detections (subscription required) that occurred each day within a specified date range.
$results = $stats->getDaily();
// You can then iterate (and auto-paginate) through all available results.
foreach ($stats->getResponsePaginator() as $metrics) {
// Do something with the log stream.
dump($logStream);
// {
// "date": "...",
// "logins": 0,
// "signups": 0,
// "leaked_passwords": 0,
// "updated_at": "...",
// "created_at": "..."
// }
}
// Or, just work with the initial batch from the response.
dd(HttpResponse::decode($results));
// [
// {
// "date": "...",
// "logins": 0,
// "signups": 0,
// "leaked_passwords": 0,
// "updated_at": "...",
// "created_at": "..."
// }
// ]
The /api/v2/tenants endpoint class is accessible from the tenants()
method on the Management API class.
Method | Endpoint | PHP Method |
---|---|---|
GET |
…/tenants/settings | getSettings() |
PATCH |
…/tenants/settings | updateSettings(body: []) |
For full usage reference of the available API methods please review the Auth0\SDK\API\Management\Tenants class.
use Auth0\SDK\Utility\HttpResponse;
$management = app('auth0')->management();
$tenants = $management->tenants();
// Retrieve the current tenant settings.
$results = $tenants->getSettings();
dd(HttpResponse::decode($results));
// {
// "change_password": {
// "enabled": false,
// "html": ""
// },
// ...
// ...
// ...
// }
The /api/v2/tickets endpoint class is accessible from the tickets()
method on the Management API class.
Method | Endpoint | PHP Method |
---|---|---|
POST |
…/tickets/password-change | createPasswordChange(body: []) |
POST |
…/tickets/email-verification | createEmailVerification(userId: '...') |
For full usage reference of the available API methods please review the Auth0\SDK\API\Management\Tickets class.
use Auth0\SDK\Utility\HttpResponse;
$management = app('auth0')->management();
$tickets = $management->tickets();
// Create a password change ticket.
$results = $tickets->createPasswordChange([
'result_url' => 'https://example.com',
'user_id' => '...',
'client_id' => '...',
'organization_id' => '...',
'connection_id' => '...',
'email' => '...',
'ttl_sec' => 3600,
'mark_email_as_verified' => true,
'includeEmailInRedirect' => true,
]);
dd(HttpResponse::decode($results));
// {
// "ticket": "https://login.auth0.com/lo/reset?..."
// }
The /api/v2/user-blocks endpoint class is accessible from the userBlocks()
method on the Management API class.
Method | Endpoint | PHP Method |
---|---|---|
GET |
…/user-blocks | get(id: '...') |
DELETE |
…/user-blocks | delete(id: '...') |
GET |
…/user-blocks/{id} | getByIdentifier(identifier: '...') |
DELETE |
…/user-blocks/{id} | deleteByIdentifier(identifier: '...') |
For full usage reference of the available API methods please review the Auth0\SDK\API\Management\UserBlocks class.
use Auth0\SDK\Utility\HttpResponse;
$management = app('auth0')->management();
$userBlocks = $management->userBlocks();
// Retrieve a list of all user blocks.
$results = $userBlocks->get('...');
dd(HttpResponse::decode($results));
// {
// "blocked_for": [
// {
// "identifier": "...",
// "ip": "..."
// }
// ]
// }
The /api/v2/users endpoint class is accessible from the users()
method on the Management API class.
Method | Endpoint | PHP Method |
---|---|---|
GET |
…/users | getAll() |
POST |
…/users | create(connection: '...', body: []) |
GET |
…/users/{id} | get(id: '...') |
PATCH |
…/users/{id} | update(id: '...', body: []) |
DELETE |
…/users/{id} | delete(id: '...') |
GET |
…/users/{id}/enrollments | getEnrollments(id: '...') |
GET |
…/users/{user}/authentication-methods | getAuthenticationMethods(user: '...') |
DELETE |
…/users/{user}/authentication-methods | deleteAuthenticationMethods(user: '...') |
POST |
…/users/{user}/authentication-methods | createAuthenticationMethod(user: '...', body: []) |
GET |
…/users/{id}/authentication-methods/{method} | getAuthenticationMethod(id: '...', method: '...') |
PATCH |
…/users/{id}/authentication-methods/{method} | updateAuthenticationMethod(id: '...', method: '...', body: []) |
DELETE |
…/users/{id}/authentication-methods/{method} | deleteAuthenticationMethod(id: '...', method: '...') |
GET |
…/users/{id}/organizations | getOrganizations(id: '...') |
GET |
…/users/{id}/logs | getLogs(id: '...') |
GET |
…/users/{id}/roles | getRoles(id: '...') |
POST |
…/users/{id}/roles | addRoles(id: '...', roles: []) |
DELETE |
…/users/{id}/roles | removeRoles(id: '...', roles: []) |
GET |
…/users/{id}/permissions | getPermissions(id: '...') |
POST |
…/users/{id}/permissions | addPermissions(id: '...', permissions: []) |
DELETE |
…/users/{id}/permissions | removePermissions(id: '...', permissions: []) |
DELETE |
…/users/{id}/multifactor/{provider} | deleteMultifactorProvider(id: '...', provider: '...') |
POST |
…/users/{id}/identities | linkAccount(id: '...', body: []) |
DELETE |
…/users/{id}/identities/{provider}/{identityId} | unlinkAccount(id: '...', provider: '...', identityId: '...') |
POST |
…/users/{id}/recovery-code-regeneration | createRecoveryCode(id: '...') |
POST |
…/users/{id}/multifactor/actions/invalidate-remember-browser | invalidateBrowsers(id: '...') |
use Auth0\SDK\Utility\HttpResponse;
$management = app('auth0')->management();
$users = $management->users();
// Create a new user.
$users->create(
connection: 'Username-Password-Authentication',
body: [
'email' => '...',
'password' => '...',
'email_verified' => true,
]
);
// Get a single user.
$result = $users->get('auth0|...');
dump(HttpResponse::decodedBody($result));
// Get all users.
$results = $users->getAll();
// You can then iterate (and auto-paginate) through all available results.
foreach ($users->getResponsePaginator() as $user) {
dump($user);
// {
// "user_id": "...",
// "email": "...",
// "email_verified": true,
// ...
// }
}
// Or, just work with the initial batch from the response.
dd(HttpResponse::decode($results));
// [
// {
// "user_id": "...",
// "email": "...",
// "email_verified": true,
// ...
// }
// ]
The Auth0\SDK\API\Management\UsersByEmail
class provides methods to access the Users by Email endpoint of the v2 Management API.
Method | Endpoint | PHP Method |
---|---|---|
GET |
…/users-by-email | get() |
use Auth0\SDK\Utility\HttpResponse;
$management = app('auth0')->management();
$usersByEmail = $management->usersByEmail();
// Get a single user by email.
$result = $usersByEmail->get('...');
dump(HttpResponse::decodedBody($result));
// {
// "user_id": "...",
// "email": "...",
// "email_verified": true,
// ...
// }