Skip to content

Latest commit

 

History

History
231 lines (149 loc) · 10.2 KB

README.md

File metadata and controls

231 lines (149 loc) · 10.2 KB

JwtTemplates

(jwt_templates)

Overview

Available Operations

  • list - List all templates
  • create - Create a JWT template
  • get - Retrieve a template
  • update - Update a JWT template
  • delete - Delete a Template

list

List all templates

Example Usage

from clerk_backend_api import Clerk

s = Clerk(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)


res = s.jwt_templates.list()

if res is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

List[models.JWTTemplate]

Errors

Error Object Status Code Content Type
models.SDKError 4xx-5xx /

create

Create a new JWT template

Example Usage

from clerk_backend_api import Clerk

s = Clerk(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)


res = s.jwt_templates.create(request={
    "name": "Example Template",
    "claims": {},
    "lifetime": 3600,
    "allowed_clock_skew": 5,
    "custom_signing_key": False,
    "signing_algorithm": "RS256",
    "signing_key": "PRIVATE_KEY_PLACEHOLDER",
})

if res is not None:
    # handle response
    pass

Parameters

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

Response

models.JWTTemplate

Errors

Error Object Status Code Content Type
models.ClerkErrors 400,402,422 application/json
models.SDKError 4xx-5xx /

get

Retrieve the details of a given JWT template

Example Usage

from clerk_backend_api import Clerk

s = Clerk(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)


res = s.jwt_templates.get(template_id="template_123")

if res is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description Example
template_id str ✔️ JWT Template ID template_123
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.JWTTemplate

Errors

Error Object Status Code Content Type
models.ClerkErrors 404 application/json
models.SDKError 4xx-5xx /

update

Updates an existing JWT template

Example Usage

from clerk_backend_api import Clerk

s = Clerk(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)


res = s.jwt_templates.update(template_id="<value>", request_body={
    "name": "<value>",
    "claims": {},
    "lifetime": 8574.78,
    "allowed_clock_skew": 245.55,
    "custom_signing_key": False,
    "signing_algorithm": "<value>",
    "signing_key": "<value>",
})

if res is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description
template_id str ✔️ The ID of the JWT template to update
request_body Optional[models.UpdateJWTTemplateRequestBody] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.JWTTemplate

Errors

Error Object Status Code Content Type
models.ClerkErrors 400,402,422 application/json
models.SDKError 4xx-5xx /

delete

Delete a Template

Example Usage

from clerk_backend_api import Clerk

s = Clerk(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)


res = s.jwt_templates.delete(template_id="<value>")

if res is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description
template_id str ✔️ JWT Template ID
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.DeletedObject

Errors

Error Object Status Code Content Type
models.ClerkErrors 403,404 application/json
models.SDKError 4xx-5xx /