Improvements to Drift-Node

This commit is contained in:
ricardo 2020-06-25 22:29:04 -04:00
parent 9a449284ae
commit e68f45c142
2 changed files with 10 additions and 3 deletions

View file

@ -15,7 +15,7 @@ export class DriftOAuth2Api implements ICredentialType {
displayName: 'Authorization URL',
name: 'authUrl',
type: 'hidden' as NodePropertyTypes,
default: 'ttps://dev.drift.com/authorize',
default: 'https://dev.drift.com/authorize',
required: true,
},
{
@ -31,6 +31,12 @@ export class DriftOAuth2Api implements ICredentialType {
type: 'hidden' as NodePropertyTypes,
default: '',
},
{
displayName: 'Scope',
name: 'scope',
type: 'hidden' as NodePropertyTypes,
default: '',
},
{
displayName: 'Authentication',
name: 'authentication',

View file

@ -46,8 +46,9 @@ export async function driftApiRequest(this: IExecuteFunctions | IWebhookFunction
return await this.helpers.requestOAuth2!.call(this, 'driftOAuth2Api', options);
}
} catch (error) {
if (error.response) {
const errorMessage = error.message || (error.response.body && error.response.body.message );
if (error.response && error.response.body && error.response.body.error) {
const errorMessage = error.response.body.error.message;
throw new Error(`Drift error response [${error.statusCode}]: ${errorMessage}`);
}
throw error;