Skip to content

Latest commit

 

History

History
156 lines (97 loc) · 6.59 KB

README.md

File metadata and controls

156 lines (97 loc) · 6.59 KB

Clients

(clients)

Overview

The Client object tracks sessions, as well as the state of any sign in and sign up attempts, for a given device. https://clerk.com/docs/reference/clerkjs/client

Available Operations

  • list - List all clients ⚠️ Deprecated
  • verify - Verify a client
  • get - Get a client

list

Returns a list of all clients. The clients are returned sorted by creation date, with the newest clients appearing first. Warning: the endpoint is being deprecated and will be removed in future versions.

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Clerk\Backend;

$security = '<YOUR_BEARER_TOKEN_HERE>';

$sdk = Backend\ClerkBackend::builder()->setSecurity($security)->build();



$response = $sdk->clients->list(
    limit: 10,
    offset: 0

);

if ($response->clientList !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
limit ?int Applies a limit to the number of results returned.
Can be used for paginating the results together with offset.
offset ?int Skip the first offset results when paginating.
Needs to be an integer greater or equal to zero.
To be used in conjunction with limit.

Response

?Operations\GetClientListResponse

Errors

Error Type Status Code Content Type
Errors\ClerkErrors 400, 401, 410, 422 application/json
Errors\SDKException 4XX, 5XX */*

verify

Verifies the client in the provided token

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Clerk\Backend;
use Clerk\Backend\Models\Operations;

$security = '<YOUR_BEARER_TOKEN_HERE>';

$sdk = Backend\ClerkBackend::builder()->setSecurity($security)->build();

$request = new Operations\VerifyClientRequestBody();

$response = $sdk->clients->verify(
    request: $request
);

if ($response->client !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\VerifyClientRequestBody ✔️ The request object to use for the request.

Response

?Operations\VerifyClientResponse

Errors

Error Type Status Code Content Type
Errors\ClerkErrors1 400, 401, 404 application/json
Errors\SDKException 4XX, 5XX */*

get

Returns the details of a client.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Clerk\Backend;

$security = '<YOUR_BEARER_TOKEN_HERE>';

$sdk = Backend\ClerkBackend::builder()->setSecurity($security)->build();



$response = $sdk->clients->get(
    clientId: '<id>'
);

if ($response->client !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
clientId string ✔️ Client ID.

Response

?Operations\GetClientResponse

Errors

Error Type Status Code Content Type
Errors\ClerkErrors2 400, 401, 404 application/json
Errors\SDKException 4XX, 5XX */*