---
title: basic
description: "Make the `auth` of an `http` Effect that sends `Authorization: Basic <value>`, where the value is the base64 of `user:password`."
---

# `basic`

Function, in `@jr2/orchestrator/src/http-effect.ts`. It is an export of `@jr2/orchestrator`, on the [Authoring surface](../authoring-surface.md) page, in Effects.

```ts
function basic<
  const U extends string | Secret | Text,
  const P extends string | Secret | Text,
>(
  user: U,
  password: P,
): MarkedIf<U | P, { readonly basic: { user: Text; password: Text } }>
```

Make the `auth` of an `http` Effect that sends `Authorization: Basic <value>`, where the value
is the base64 of `user:password`. The Effector puts in the value of each secret.

Each of `user` and `password` is a string, a `secret(...)` or a `text`. In a packaged Machine,
one of them can hold `secret(open)`. It refuses another value: `` expected a string, a
secret("name") or a text`…`, got <value> ``.

**Parameters**

- `user`: The user name: a string, a `secret(...)` or a `text`.
- `password`: The password: a string, a `secret(...)` or a `text`.

**Returns**: The `auth` of an `http` Effect.

**Example**

```ts
import { basic, http, jr2Setup, secret } from "@jr2/orchestrator";

export const machine = jr2Setup({
  actors: {
    issue: http({
      method: "GET",
      url: "https://jira.example.com/rest/api/2/issue/APP-1",
      auth: basic("jr2-bot@example.com", secret("jira-token")),
    }),
  },
}).createMachine({
  id: "issue",
  initial: "reading",
  states: {
    reading: { invoke: { src: "issue", onDone: "done" } },
    done: { type: "final" },
  },
});
```

**See also**

- [Run a command or call a URL with an Effect](../../guides/run-a-command-or-call-a-url.md)
- [Secrets and trust](../../concepts/secrets-and-trust.md)
- [ADR-0068: An Effector holds an Effect's secrets and signs its wire](../decisions/0068-an-effector-holds-an-effects-secrets-and-signs-its-wire.md)
- [ADR-0054: The kit ships Machines, and a shipped Machine leaves its parts Open](../decisions/0054-the-kit-ships-machines-and-a-shipped-machine-leaves-its-parts-open.md)
