authBasicApiTokenSchema (schemas/auth.ts)

jira.js · src/core/schemas/auth.ts · typescript · MIT
auth

Module exposing: authBasicApiTokenSchema, authBasicPasswordSchema, authBasicSchema, authBearerTokenSchema, authBearerProviderSchema, authBearerSchema, authOAuth2Schema, authOAuth2ServerSchema

// Source: https://github.com/MrRefactoring/jira.js | License: MIT | Copyright 2020 Vladislav Tupikin
// Provided via justclaw.it.com; keep this notice with the code.
import { z } from 'zod';
import type { OnTokenRefresh } from '../oauth/types.js';

/** Cloud: an Atlassian account address and an API token minted for it. */
export const authBasicApiTokenSchema = z.object({
  type: z.literal('basic'),
  email: z.string().email(),
  apiToken: z.string().min(1),
});

/**
 * Data Center: a local account name and its password.
 *
 * A separate branch rather than a loosened `email`, because the two are not interchangeable — a Cloud site rejects a
 * username, a self-hosted one has no notion of an API token, and a typo that swaps them should be a validation error
 * rather than a 401 an hour later

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key