Lightning.Channels.DestinationAuth (Lightning v2.19.0-pre)
View SourceMaps a credential's schema type and body to an outbound HTTP Authorization header.
Supported Schemas
"http"— Bearer token (access_token) or Basic auth (username+password)"dhis2"— DHIS2 ApiToken (pat) or Basic auth (username+password)"oauth"— Bearer token (access_token, with auto-refresh viaresolve_credential_body)
Schemas not in this list are rejected at config time. If an unsupported schema
somehow reaches runtime, build_auth_header/2 returns an error.
Summary
Functions
Given a credential schema name and decrypted body map, returns the Authorization header value to set on the outbound request.
Functions
@spec build_auth_header(String.t(), map()) :: {:ok, String.t()} | {:error, :no_auth_fields | {:unsupported_schema, String.t()}}
Given a credential schema name and decrypted body map, returns the Authorization header value to set on the outbound request.
Returns:
{:ok, header_value}— e.g.,"Bearer tok123"or"Basic dTpw"{:error, :no_auth_fields}— credential body missing required auth fields{:error, {:unsupported_schema, schema}}— schema not in supported list