JWT plugin

This commit is contained in:
Gregory Schier
2025-01-17 14:38:17 -08:00
parent 064416398b
commit 16af8bf008
6 changed files with 22 additions and 33 deletions

View File

@@ -12,15 +12,10 @@ export const plugin: PluginDefinition = {
optional: true,
password: true,
}],
async onApply(_ctx: any, args: any): Promise<any> {
async onApply(_ctx, args) {
const { token } = args.config;
return {
url: args.url,
headers: [{
name: 'Authorization',
value: `Bearer ${token}`.trim(),
}],
};
const value = `Bearer ${token}`.trim();
return { setHeaders: [{ name: 'Authorization', value }] };
},
},
};