Add API key auth

https://feedback.yaak.app/p/header-as-auth-option
This commit is contained in:
Gregory Schier
2025-07-20 09:15:03 -07:00
parent 947926ca34
commit 144faad31f
12 changed files with 153 additions and 52 deletions

View File

@@ -21,7 +21,12 @@ export type CallHttpAuthenticationResponse = {
* HTTP headers to add to the request. Existing headers will be replaced, while
* new headers will be added.
*/
setHeaders: Array<HttpHeader>, };
setHeaders?: Array<HttpHeader>,
/**
* Query parameters to add to the request. Existing params will be replaced, while
* new params will be added.
*/
setQueryParameters?: Array<HttpHeader>, };
export type CallHttpRequestActionArgs = { httpRequest: HttpRequest, };

View File

@@ -253,12 +253,11 @@ export class PluginInstance {
const auth = this.#mod.authentication;
if (typeof auth?.onApply === 'function') {
applyFormInputDefaults(auth.args, payload.values);
const result = await auth.onApply(ctx, payload);
this.#sendPayload(
windowContext,
{
type: 'call_http_authentication_response',
setHeaders: result.setHeaders,
...(await auth.onApply(ctx, payload)),
},
replyId,
);
@@ -579,7 +578,7 @@ export class PluginInstance {
event.windowContext,
payload,
);
return result.data;
return result.data as any;
},
},
store: {