Private repositories
There may be instances where you want to load a remote module that is located in a private repository, like a private repository on GitHub.
Ende supports sending bearer tokens when requesting a remote module. Bearer tokens are the predominant type of access token used with OAuth 2.0, and are broadly supported by hosting services (e.g., GitHub, GitLab, Bitbucket, Cloudsmith, etc.).
ENDE_AUTH_TOKENS
The Ende CLI will look for an environment variable named ENDE_AUTH_TOKENS to
determine what authentication tokens it should consider using when requesting
remote modules. The value of the environment variable is in the format of n
number of tokens delimited by a semi-colon (;) where each token is either:
- a bearer token in the format of
{token}@{hostname[:port]}or - basic auth data in the format of
{username}:{password}@{hostname[:port]}
For example, a single token for ende.sh would look something like this:
[email protected]
or:
ENDE_AUTH_TOKENS=username:[email protected]
And multiple tokens would look like this:
[email protected];f1e2d3c4b5a6@example.com:8080;username:[email protected]
When Ende goes to fetch a remote module, where the hostname matches the hostname
of the remote module (see Matching hosts), Ende will set the
Authorization header of the request to the value of Bearer {token} or
Basic {base64EncodedData}. This allows the remote server to recognize that
the request is an authorized request tied to a specific authenticated user, and
provide access to the appropriate resources and modules on the server.
Ende doesn't send a token over plain http, which would show it to anyone on
the network, except to this machine: localhost, names under it such as
app.localhost, and loopback addresses such as 127.0.0.1 and [::1]. For any
other host it fetches without the token and warns once
(Ende 2026.12.01+):
Warning An auth token is set for example.com, but it isn't sent over plain http; use https.
Child processes inherit ENDE_AUTH_TOKENS like any other environment variable,
so every program Ende starts, such as git or a subprocess of your program, gets
your tokens too. To keep them out of the environment, use the tokens file.
The tokens file
Ende 2026.12.01
The tokens file is new in this release.
Ende also reads tokens from a file named auth_tokens in its config folder:
| Platform | Path |
|---|---|
| macOS | ~/Library/Application Support/ende/auth_tokens |
| Linux | ~/.config/ende/auth_tokens |
| Windows | %LOCALAPPDATA%\ende-config\auth_tokens |
An absolute XDG_CONFIG_HOME moves it to $XDG_CONFIG_HOME/ende/auth_tokens
on every platform. ENDE_DIR doesn't move it.
The file takes one token per line, in the same {token}@{hostname[:port]} or
{username}:{password}@{hostname[:port]} format as the variable. Blank lines
and lines that start with # are skipped:
# GitHub, read-only
[email protected]
username:[email protected]:8080On macOS and Linux, create it readable by you alone. On Linux, for example:
mkdir -p ~/.config/ende
touch ~/.config/ende/auth_tokens
chmod 600 ~/.config/ende/auth_tokens
Ende uses the file only if it is a regular file (a symlink to one is fine),
owned by you, that only you have any access to. Otherwise it
prints an error, ignores the file and goes on with ENDE_AUTH_TOKENS alone:
error: /home/me/.config/ende/auth_tokens can be read or changed by other users, so its tokens are not used. Make it private with `chmod 600 "/home/me/.config/ende/auth_tokens"`.
On Windows there is no such check: %LOCALAPPDATA% is protected by the
permissions of your user profile. It isn't part of the roaming profile, so on a
domain with roaming profiles the file isn't copied to the profile server.
Ende reads the file into its own process and never puts the tokens in the
environment, so programs Ende starts that aren't ende, such as git or a
subprocess of your program, don't see them. Any ende you start, for example
from ende task, reads the file itself and uses the tokens. Nor does the file
hide the tokens from your own program: a script that may read the config folder
can read the file.
When more than one token names the same host, the first match wins, in this order:
ENDE_AUTH_TOKENSfrom the environment Ende started with (your shell, or the process that started Ende);- the tokens file;
- tokens an env file gives
under
ENDE_AUTH_TOKENSorDENO_AUTH_TOKENS, so a project can't override your own tokens.
Tokens are merged host by host, so a token for a host that only the env file names is still used.
Ende 2026.12.01
Env-file tokens are no longer set as ENDE_AUTH_TOKENS or
DENO_AUTH_TOKENS.
Ende doesn't set an env file's tokens under either of those names, so your
program and the tools Ende runs don't see them there. It keeps them in an
internal variable, ENDE_INTERNAL_ENV_FILE_AUTH_TOKENS, which child processes
inherit like any other variable. A child ende, and a binary built with
ende compile --env-file, rank them last too.
Matching hosts
Ende 2026.12.01
A token now goes only to the host it names. Earlier releases also sent a token
for example.com to every subdomain of it, such as api.example.com.
Each entry, in ENDE_AUTH_TOKENS or the tokens file, names the host its token
is sent to:
- A host matches only itself. A token for
example.comisn't sent toapi.example.com, and a token forapi.example.comisn't sent toexample.com. A leading dot is dropped, so.example.comis the same entry asexample.com. *.example.commatches every subdomain ofexample.com, at any depth, such asapi.example.comanda.b.example.com, but notexample.comitself. Add an entry forexample.comas well to cover both.*is only allowed at the start, followed by a dot and a host name; any other entry with a*is discarded as badly formed.- An entry without a port matches URLs that leave the port out (or give the
scheme's default port). An entry with a port matches only that port, and a
default port also matches URLs that leave it out:
example.com:443matcheshttps://example.com/, but nothttp://example.com/. - An IP address matches only itself, with the same port rules. Write an IPv6
address in brackets, such as
[2001:db8::1]. A*.entry never matches an IP address, and*.followed by an IP address is discarded. - A host name with non-ASCII characters is compared in its ASCII form, so
bücher.dematches bothhttps://bücher.de/andhttps://xn--bcher-kva.de/. - Host names match in any case.
When more than one entry matches a URL, the first one wins: entries from
ENDE_AUTH_TOKENS, then the tokens file, then env files, each in the order they
are written. Put an entry for a specific host, such as api.example.com, before
a *.example.com entry that would also match it.
When no entry matches a subdomain of a host that has a token, Ende fetches it without one and warns, because earlier releases sent that host's token there:
Warning An auth token is set for example.com, but it isn't sent to api.example.com: a token goes only to the host it names. To send it to subdomains too, add an entry for *.example.com.
Ende warns once for each pair of hosts per run of ende, and remembers nothing
between runs. It doesn't warn for a plain http URL to another machine, where
the token wouldn't be sent anyway.
GitHub
To access private repositories on GitHub, you would need to issue yourself a personal access token. You do this by logging into GitHub and going under Settings -> Developer settings -> Personal access tokens:

You would then choose to Generate new token and give your token a description
and appropriate access to the repo scope. The repo scope will enable reading
file contents (more on
scopes in the GitHub docs):

And once created GitHub will display the new token a single time, the value of which you would want to use in the environment variable:

In order to access modules that are contained in a private repository on GitHub,
you would want to use the generated token in the ENDE_AUTH_TOKENS environment
variable scoped to the raw.githubusercontent.com hostname. For example:
[email protected]
This should allow Ende to access any modules that the user who the token was issued for has access to.
When the token is incorrect, or the user does not have access to the module,
GitHub will issue a 404 Not Found status, instead of an unauthorized status.
So if you are getting errors that the modules you are trying to access are not
found on the command line, check the environment variable settings and the
personal access token settings.
In addition, ende run -L debug should print out a debug message about the
number of tokens that are parsed out of the environment variable. It will print
an error message if it feels any of the tokens are malformed. It won't print any
details about the tokens for security purposes. The count includes the tokens
file, and an error about a malformed token in the file names its line
(Ende 2026.12.01+).