Deno supports sending bearer tokens when requesting a remote module. Bearer tokens are the predominate type of access token used with OAuth 2.0 and is broadly supported by hosting services (e.g. GitHub, Gitlab, BitBucket, Cloudsmith, etc.).

    The Deno CLI will look for an environment variable named to determine what authentication tokens it should consider using when requesting remote modules. The value of the environment variable is in the format of a n number of tokens deliminated by a semi-colon (;) where each token is in the format of {token}@{hostname[:port]}.

    For example a single token for would look something like this:

    And multiple tokens would look like this:

    GitHub

    To be able 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:

    In order to access modules that are contained in a private repository on GitHub, you would want to use the generated token in the DENO_AUTH_TOKENS environment variable scoped to the hostname. For example:

    This should allow Deno 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.