(actor_tokens)
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.
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)
models.ActorToken
Error Type |
Status Code |
Content Type |
models.ClerkErrors |
400, 402, 422 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |
Revokes a pending actor token.
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)
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. |
|
models.ActorToken
Error Type |
Status Code |
Content Type |
models.ClerkErrors |
400, 404 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |