EndPointBlank.Authorization (end_point_blank_elixir v0.6.0)

Copy Markdown

Builds Authorization headers for outbound requests to the EndPointBlank API.

Returns a Bearer token header when a token can be obtained for the target base URL, otherwise falls back to HTTP Basic auth.

Summary

Functions

Returns Base64-encoded client_id:client_secret.

Returns an HTTP Basic Authorization header value.

Returns the best available Authorization header value for the given base URL.

Functions

basic_credentials()

Returns Base64-encoded client_id:client_secret.

basic_header()

Returns an HTTP Basic Authorization header value.

header(base_url \\ nil)

Returns the best available Authorization header value for the given base URL.

base_url is the URL you are about to call, with any query string and fragment removed. Returns "Bearer <token>" when a token can be obtained for it — minting one if no usable entry covers it yet — and "Basic <credentials>" otherwise.

Asking for the token rather than first checking whether one exists is what makes the Bearer path reachable at all. Nothing else mints the first token, so gating on AccessTokens.exists?/1 left every call authenticating with the long-lived client credentials for the life of the node.

Callers with no target base URL — the log writers, and every call this SDK itself makes to intake — get Basic, and so does GenerateAccessToken, which uses basic_header/0 directly and must not present a Bearer to the endpoint that issues them.