createJwtTemplate()
Creates a JWT template on the deployment route.
Usage
The following example shows a basic usage of the backend client from @wacht/nextjs/server.
import { wachtClient } from '@wacht/nextjs/server';export async function createTemplate() { const client = await wachtClient(); return client.settings.createJwtTemplate({ name: 'default', token_lifetime: 3600, allowed_clock_skew: 60, template: {}, });}Signature
function createJwtTemplate( request: CreateJwtTemplateRequest,): Promise<JwtTemplate>CreateJwtTemplateRequest
›name?: string | undefined;
name?: string | undefined;Template display name.
›token_lifetime?: number | undefined;
token_lifetime?: number | undefined;Token lifetime in seconds.
›allowed_clock_skew?: number | undefined;
allowed_clock_skew?: number | undefined;Allowed clock skew in seconds.
›custom_signing_key?: CustomSigningKey | undefined;
custom_signing_key?: CustomSigningKey | undefined;Optional custom signing key config.
›kid?: string | undefined;
kid?: string | undefined;Signing key id.
›alg?: string | undefined;
alg?: string | undefined;Signing algorithm.
›private_key?: string | undefined;
private_key?: string | undefined;PEM/JWK private signing key material.
›template?: Record<string, unknown> | undefined;
template?: Record<string, unknown> | undefined;JWT claims template definition.
›sub?: string | undefined;
sub?: string | undefined;Subject claim template.
›role?: string | undefined;
role?: string | undefined;Role/authorization claim template.
›metadata?: Record<string, unknown> | undefined;
metadata?: Record<string, unknown> | undefined;Additional custom claim object.
›tenant_id?: string | undefined;
tenant_id?: string | undefined;Example tenant identifier claim.
›plan?: string | undefined;
plan?: string | undefined;Example plan claim.
Return value
›id?: string | undefined;
id?: string | undefined;Created template id.
›name?: string | undefined;
name?: string | undefined;Created template name.
›token_lifetime?: number | undefined;
token_lifetime?: number | undefined;Configured token lifetime.
Behavior
- Creates a new resource and returns the created object from the backend.
- Validate required fields before calling to avoid predictable request failures.