Adjusted credentials screen

This commit is contained in:
Rupenieks 2020-06-25 09:53:00 +02:00
parent d8842838f5
commit 055b9c65f2
2 changed files with 7 additions and 25 deletions

View file

@ -35,33 +35,20 @@ export class WordpressOAuth2Api implements ICredentialType {
{
displayName: 'Scope',
name: 'scope',
type: 'string' as NodePropertyTypes,
default: 'global',
type: 'hidden' as NodePropertyTypes,
default: '',
},
{
displayName: 'Auth URI Query Parameters',
name: 'authQueryParameters',
type: 'string' as NodePropertyTypes,
default: 'grant_type=authorization_code',
type: 'hidden' as NodePropertyTypes,
default: '',
},
{
displayName: 'Authentication',
name: 'authentication',
type: 'options' as NodePropertyTypes,
options: [
{
name: 'Body',
value: 'body',
description: 'Send credentials in body',
},
{
name: 'Header',
value: 'header',
description: 'Send credentials as Basic Auth header',
},
],
default: 'header',
description: 'Resource to consume.',
type: 'hidden' as NodePropertyTypes,
default: 'body'
},
];
}

View file

@ -53,12 +53,7 @@ export async function wordpressApiRequest(this: IExecuteFunctions | IExecuteSing
return await this.helpers.requestOAuth2!.call(this, 'wordpressOAuth2Api', options);
}
} catch (error) {
let errorMessage = error.message;
if (error.response.body) {
errorMessage = error.response.body.message || error.response.body.Message || error.message;
}
throw new Error('Wordpress Error: ' + errorMessage);
throw new Error('Wordpress Error: ' + error);
}
}