Bitbucket Data Center API Client
    Preparing search index...

    Class Security

    Handles Basic Authentication for Bitbucket Data Center REST API requests.

    const security = new Security(
    'https://bitbucket.example.com',
    'my-user',
    'my-token'
    );

    const headers = security.getHeaders();
    // { Authorization: 'Basic <base64>', 'Content-Type': 'application/json', Accept: 'application/json' }
    Index

    Constructors

    • Creates a new Security instance with Basic Authentication credentials.

      Parameters

      • apiUrl: string

        The base URL of the Bitbucket Data Center instance (e.g., https://bitbucket.example.com). Must be a valid URL; throws if it cannot be parsed.

      • user: string

        The username to authenticate with

      • token: string

        The personal access token or password to authenticate with

      Returns Security

      If apiUrl is not a valid URL

    Methods

    • Returns the base URL of the Bitbucket Data Center instance, without a trailing slash.

      Returns string

      The API base URL

    • Returns the value of the Authorization header for Basic Authentication.

      Returns string

      The Authorization header value in the format Basic <base64-encoded-credentials>

    • Returns the full set of HTTP headers required for authenticated API requests.

      Returns Record<string, string>

      An object containing Authorization, Content-Type, and Accept headers