(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
s = Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.actor_tokens.create(request={
"user_id": "user_1a2b3c",
"actor": {},
"expires_in_seconds": 3600,
"session_max_duration_in_seconds": 1800,
})
if res is not None:
# handle response
pass
models.ActorToken
Error Object |
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
s = Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.actor_tokens.revoke(actor_token_id="act_tok_abcdefghijk")
if res is not None:
# handle response
pass
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 Object |
Status Code |
Content Type |
models.ClerkErrors |
400,404 |
application/json |
models.SDKError |
4xx-5xx |
/ |