mirror of
https://github.com/n8n-io/n8n-nodes-starter.git
synced 2025-10-28 06:02:25 -05:00
Improve example credential
This commit is contained in:
parent
de7c4dbed1
commit
7ac69f816e
1 changed files with 33 additions and 5 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import { ICredentialType, NodePropertyTypes } from 'n8n-workflow';
|
import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, NodePropertyTypes } from 'n8n-workflow';
|
||||||
|
|
||||||
export class ExampleCredentials implements ICredentialType {
|
export class ExampleCredentials implements ICredentialType {
|
||||||
name = 'exampleCredentials';
|
name = 'exampleCredentials';
|
||||||
|
|
@ -8,16 +8,44 @@ export class ExampleCredentials implements ICredentialType {
|
||||||
// Properties can be defined exactly in the same way
|
// Properties can be defined exactly in the same way
|
||||||
// as node properties.
|
// as node properties.
|
||||||
{
|
{
|
||||||
displayName: 'User',
|
displayName: 'User Name',
|
||||||
name: 'user',
|
name: 'username',
|
||||||
type: 'string' as NodePropertyTypes,
|
type: 'string' as NodePropertyTypes,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Access Token',
|
displayName: 'Password',
|
||||||
name: 'accessToken',
|
name: 'password',
|
||||||
type: 'string' as NodePropertyTypes,
|
type: 'string' as NodePropertyTypes,
|
||||||
|
typeOptions: {
|
||||||
|
password: true,
|
||||||
|
},
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// This credential is currently not used by any node directly
|
||||||
|
// but the HTTP Request node can use it to make requests.
|
||||||
|
// The credential is also testable due to the `test` property below
|
||||||
|
authenticate = {
|
||||||
|
type: 'generic',
|
||||||
|
properties: {
|
||||||
|
auth: {
|
||||||
|
username: '={{ $credentials.username }}',
|
||||||
|
password: '={{ $credentials.password }}',
|
||||||
|
},
|
||||||
|
qs: {
|
||||||
|
// Send this as part of the query string
|
||||||
|
n8n: 'rocks',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
} as IAuthenticateGeneric;
|
||||||
|
|
||||||
|
// The block below tells how this credential can be tested
|
||||||
|
test: ICredentialTestRequest = {
|
||||||
|
request: {
|
||||||
|
baseURL: 'https://example.com/',
|
||||||
|
url: '',
|
||||||
|
},
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue