Skip to main content

Module auth

Module auth 

Source
Expand description

Which request headers carry a token, per integration kind. Pure: no I/O, so every scheme is a table-test row.

KindHeader(s)
github*Authorization: Bearer <token>
gitlab*PRIVATE-TOKEN: <token> + Authorization: Bearer <token>
azure_devops*Authorization: Basic b64(":" + token)
bitbucketAuthorization: Basic b64(account + ":" + token); empty account: Bearer (workspace / repository access tokens)
gitea, forgejoAuthorization: token <token>
bitbucket_data_center, jira_data_centerAuthorization: Bearer <token>
jira_cloudAuthorization: Basic b64(account + ":" + token)
linearAuthorization: <api key> (no Bearer)
youtrackAuthorization: Bearer <permanent token>
redmineX-Redmine-API-Key: <api key>
gerritAuthorization: Basic b64(account + ":" + HTTP password)
trelloAuthorization: OAuth oauth_consumer_key="<account>", oauth_token="<token>"

A Jira Cloud profile with no account still yields a (useless) Basic header: the host answers 401 and the form asks for the email, rather than this layer inventing a second error path.

Functions§

auth_headers
The headers that authenticate token for integration.
base64
RFC 4648 base64 with padding. Twenty lines beat a dependency.
git_username
The user name git’s HTTPS transport sends together with token for kind, or None for a kind that is not a code host (issue trackers, a folder of notes). Pure, so every host is a table-test row.