@mintlify/common
Version:
Commonly shared code within Mintlify
62 lines (61 loc) • 2.18 kB
JavaScript
export const getSecurityOptionsForAuthMethod = (method, name) => {
switch (method) {
case 'basic':
return [
{
title: 'Basic Auth',
parameters: {
header: {
Authorization: {
type: 'http',
scheme: 'basic',
description: 'Basic authentication header of the form `Basic <encoded-value>`, where `<encoded-value>` is the base64-encoded string `username:password`.',
},
},
query: {},
cookie: {},
},
},
];
case 'bearer':
return [
{
title: 'Bearer Auth',
parameters: {
header: {
Authorization: {
type: 'http',
scheme: 'bearer',
description: 'Bearer authentication header of the form `Bearer <token>`, where `<token>` is your auth token.',
},
},
query: {},
cookie: {},
},
},
];
case 'cobo':
return [
{
title: name !== null && name !== void 0 ? name : 'Cobo Auth',
parameters: {
header: { 'API-SECRET': { type: 'apiKey' } },
query: {},
cookie: {},
},
},
];
case 'key':
return [
{
title: 'API Key Auth',
parameters: {
header: { [name !== null && name !== void 0 ? name : 'Key']: { type: 'apiKey' } },
query: {},
cookie: {},
},
},
];
}
return [];
};