@kosha-ai/integration-basic
v0.5.2
Published
Basic-auth integration for Kosha: any API behind a username and password
Readme
@kosha-ai/integration-basic
Any API behind HTTP Basic auth.
Unlike every other integration there is no provider here: the operator gives a
base URL per configuration, the end user gives a username and password, and
Kosha proxies with Authorization: Basic base64(username:password).
import { basic } from '@kosha-ai/integration-basic';
export default defineConfig({
integrations: [basic()],
});Rename the two fields where the API calls them something else:
basic({
credentialFields: [
{ key: 'username', label: 'Email', type: 'string', required: true },
{
key: 'password',
label: 'API token',
type: 'string',
required: true,
secret: true,
},
],
});What it does not do
No identity. An arbitrary API has no endpoint meaning "this credential is good", so nothing is checked at connect and a wrong password surfaces on the first proxied call. The connection is labelled with the username because that is the only identity available.
No refresh. A password does not expire on a schedule anyone can see.
The base URL
Operator-supplied and called by the server, so it is checked on every proxied request: https only, and refused if the hostname resolves to a loopback, link-local, private or carrier-grade NAT address. Checked per request rather than only when saved, since a hostname that answers publicly today can answer privately tomorrow.
