Skip to content

Latest commit

 

History

History
104 lines (66 loc) · 3.73 KB

README.md

File metadata and controls

104 lines (66 loc) · 3.73 KB

ActorTokens

(actorTokens)

Overview

Available Operations

create

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.

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\CreateActorTokenRequestBody(
    userId: '<id>',
    actor: new Operations\Actor(),
);

$response = $sdk->actorTokens->create(
    request: $request
);

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

Parameters

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

Response

?Operations\CreateActorTokenResponse

Errors

Error Type Status Code Content Type
Errors\ClerkErrors53 400, 402, 422 application/json
Errors\SDKException 4XX, 5XX */*

revoke

Revokes a pending actor token.

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->actorTokens->revoke(
    actorTokenId: '<id>'
);

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

Parameters

Parameter Type Required Description
actorTokenId string ✔️ The ID of the actor token to be revoked.

Response

?Operations\RevokeActorTokenResponse

Errors

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