Skip to content

Latest commit

 

History

History
90 lines (61 loc) · 4.44 KB

README.md

File metadata and controls

90 lines (61 loc) · 4.44 KB

SignInTokens

(sign_in_tokens)

Overview

Available Operations

  • create - Create sign-in token
  • revoke - Revoke the given sign-in token

create

Creates a new sign-in token and associates it with the given user. By default, sign-in tokens expire in 30 days. You can optionally supply a different duration in seconds using the expires_in_seconds property.

Example Usage

from clerk_backend_api import Clerk

with Clerk(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as s:
    res = s.sign_in_tokens.create(request={
        "user_id": "user_12345",
        "expires_in_seconds": 2592000,
    })

    if res is not None:
        # handle response
        pass

Parameters

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

Response

models.SignInToken

Errors

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

revoke

Revokes a pending sign-in token

Example Usage

from clerk_backend_api import Clerk

with Clerk(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as s:
    res = s.sign_in_tokens.revoke(sign_in_token_id="tok_test_1234567890")

    if res is not None:
        # handle response
        pass

Parameters

Parameter Type Required Description Example
sign_in_token_id str ✔️ The ID of the sign-in token to be revoked tok_test_1234567890
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.SignInToken

Errors

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