(actorTokens)
Create an actor token that can be used to impersonate the given user.
The actor
parameter needs to include at least a "sub" key whose value is the ID of the actor (impersonating) user.
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\CreateActorTokenRequestBody(
userId: '<id>',
actor: new Operations\Actor(),
);
$response = $sdk->actorTokens->create(
request: $request
);
if ($response->actorToken !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\CreateActorTokenRequestBody | ✔️ | The request object to use for the request. |
?Operations\CreateActorTokenResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\ClerkErrors53 | 400, 402, 422 | application/json |
Errors\SDKException | 4XX, 5XX | */* |
Revokes a pending actor token.
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->actorTokens->revoke(
actorTokenId: '<id>'
);
if ($response->actorToken !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
actorTokenId |
string | ✔️ | The ID of the actor token to be revoked. |
?Operations\RevokeActorTokenResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\ClerkErrors54 | 400, 404 | application/json |
Errors\SDKException | 4XX, 5XX | */* |