Skip to content

Latest commit

 

History

History
95 lines (62 loc) · 4.44 KB

README.md

File metadata and controls

95 lines (62 loc) · 4.44 KB

ActorTokens

(actor_tokens)

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

from clerk_backend_api import Clerk

with Clerk(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:

    res = clerk.actor_tokens.create(request={
        "user_id": "user_1a2b3c",
        "actor": {},
        "expires_in_seconds": 3600,
        "session_max_duration_in_seconds": 1800,
    })

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
request models.CreateActorTokenRequestBody ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.ActorToken

Errors

Error Type Status Code Content Type
models.ClerkErrors 400, 402, 422 application/json
models.SDKError 4XX, 5XX */*

revoke

Revokes a pending actor token.

Example Usage

from clerk_backend_api import Clerk

with Clerk(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:

    res = clerk.actor_tokens.revoke(actor_token_id="act_tok_abcdefghijk")

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
actor_token_id str ✔️ The ID of the actor token to be revoked. act_tok_abcdefghijk
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.ActorToken

Errors

Error Type Status Code Content Type
models.ClerkErrors 400, 404 application/json
models.SDKError 4XX, 5XX */*