# Beacon node authentication

## HTTP Basic Access Authentication

If you want to use Charon with an [HTTP basic access authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) protected beacon node, then you can supply `charon run` with the `--beacon-node-headers` flag. The flag's value should be set like: `Authorization=Basic <credentials>` where `Authorization` will be the header key and `Basic <credentials>` will be the header value. The `<credentials>` are a [Base64](https://en.wikipedia.org/wiki/Base64) encoding of the username and password joined by a single colon `:`.

{% hint style="warning" %}
These headers will be sent in every request to every beacon node. This could leak your credentials to the other beacon nodes. Make sure you trust every listed beacon node.
{% endhint %}

## Usage example

Suppose we have an HTTP Basic access protected beacon node with username `john` and password `doe`. To access it we would construct the credentials by running the following command:

```
echo -n "john:doe" | base64
```

Then you could pass the flag to your Charon instance like this:

```
charon run --beacon-node-headers="Authorization=Basic am9objpkb2U="
```

Or you could specify it as an environment variable like this:

```
CHARON_BEACON_NODE_HEADERS="Authorization=Basic am9objpkb2U="
```

{% hint style="info" %}
Note that 'Authorization' is followed with an `=` rather than the usual `:`.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.obol.org/advanced-and-troubleshooting/advanced/beacon-node-authentication.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
