Add auth plugins

This commit is contained in:
Gregory Schier
2025-01-16 15:28:25 -08:00
parent e213c76870
commit ebb7b69dd8
6 changed files with 295 additions and 7 deletions

View File

@@ -0,0 +1,23 @@
import { PluginDefinition } from '@yaakapp/api';
export const plugin: PluginDefinition = {
authentication: {
name: 'Bearer',
config: [{
type: 'text',
name: 'token',
label: 'Token',
optional: true,
}],
async onApply(_ctx: any, args: any): Promise<any> {
const { token } = args.config;
return {
url: args.url,
headers: [{
name: 'Authorization',
value: `Bearer ${token}`.trim(),
}],
};
},
},
};