Clickup OAuth2 support (#649)

* OAuth2 credentials, genericFunctions needed config, UI options for oauth2 support

*  Added options to decide when to to send the bearer

* Fixed "undefined property split" issue

*  Small fix

*  Improvements to ClickUp-Node

*  Improvements

Co-authored-by: Rupenieks <ru@myos,co>
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
Co-authored-by: Ricardo Espinoza <ricardo@n8n.io>
This commit is contained in:
Rupenieks
2020-09-16 09:16:06 +02:00
committed by GitHub
parent 7c54cf6ac2
commit 266112a8cb
7 changed files with 152 additions and 10 deletions

View File

@@ -152,6 +152,12 @@ export function requestOAuth2(this: IAllExecuteFunctions, credentialsType: strin
// on the token-type used.
const newRequestOptions = token.sign(requestOptions as clientOAuth2.RequestObject);
// If keep bearer is false remove the it from the authorization header
if (oAuth2Options?.keepBearer === false) {
//@ts-ignore
newRequestOptions?.headers?.Authorization = newRequestOptions?.headers?.Authorization.split(' ')[1];
}
return this.helpers.request!(newRequestOptions)
.catch(async (error: IResponseError) => {
// TODO: Check if also other codes are possible