<@U04SE163WC8> what does BasicHttpAuthenticator ta...
# ask-ai
k
@kapa.ai what does BasicHttpAuthenticator take input and what command does it execute internally
u
The
BasicHttpAuthenticator
in Airbyte is used to set the "Authorization" header with a (USER ID/password) pair, encoded using base64 as per [RFC 7617](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#basic_authentication_scheme). The following definition will set the header "Authorization" with a value
Basic {encoded credentials}
. The
BasicHttpAuthenticator
takes two inputs:
username
and
password
. The
password
is optional. Here is the schema for `BasicHttpAuthenticator`:
Copy code
yaml BasicHttpAuthenticator:     type: object     additionalProperties: true     required:       - username     properties:       "$parameters":         "$ref": "#/definitions/$parameters"       username:         type: string       password:         type: string
And here are examples of how to use it:
Copy code
yaml authenticator:     type: "BasicHttpAuthenticator"     username: "hello"     password: "world"
Copy code
yaml authenticator:     type: "BasicHttpAuthenticator"     username: "hello"
Internally, the
BasicHttpAuthenticator
concatenates the username and password with a colon
:
and encodes the resulting string using the base64 algorithm. This encoded string is then used to set the "Authorization" header in the HTTP request. For example, for username
user
and password
passwd
, the base64-encoding of
user:passwd
is
dXNlcjpwYXNzd2Q=
. The HTTP request would then include the header
Authorization: Basic dXNlcjpwYXNzd2Q=
. For more information, you can refer to the [BasicHttpAuthenticator Reference](https://docs.airbyte.com/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/BasicHttpAuthenticator) and the [Basic HTTP Authentication method](https://docs.airbyte.com/connector-development/connector-builder-ui/authentication#basic-http) in the Airbyte documentation.