mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
import {
|
|
IAuthenticateHeaderAuth,
|
|
ICredentialType,
|
|
INodeProperties,
|
|
} from 'n8n-workflow';
|
|
|
|
export class MetabaseApi implements ICredentialType {
|
|
name = 'metabaseApi';
|
|
displayName = 'Metabase API';
|
|
documentationUrl = 'metabase';
|
|
extends = [
|
|
'renovateMetabaseToken',
|
|
];
|
|
properties: INodeProperties[] = [
|
|
{
|
|
displayName: 'Api url',
|
|
name: 'url',
|
|
type: 'string',
|
|
default: '',
|
|
},
|
|
{
|
|
displayName: 'Username',
|
|
name: 'username',
|
|
type: 'string',
|
|
default: '',
|
|
},
|
|
{
|
|
displayName: 'Password',
|
|
name: 'password',
|
|
type: 'string',
|
|
typeOptions: {
|
|
password: true,
|
|
},
|
|
default: '',
|
|
},
|
|
];
|
|
|
|
// ! Special authentication is needed, because the Metabase API is using a special auth
|
|
// ! 1st solution would be to authenticate at every request, but this is bad for performance
|
|
// ! 2nd solution is to use a implement a special auth function just for Metabase
|
|
|
|
// async authenticate(credentials: ICredentialDataDecryptedObject, requestOptions: IHttpRequestOptions): Promise<IHttpRequestOptions> {
|
|
// requestOptions.headers!['X-Metabase-Session'] = `${credentials.sessionToken}`;
|
|
// return requestOptions;
|
|
// }
|
|
|
|
}
|