diff --git a/packages/editor-ui/src/components/NodeCredentials.vue b/packages/editor-ui/src/components/NodeCredentials.vue index 679b1cba53..6fd88391a0 100644 --- a/packages/editor-ui/src/components/NodeCredentials.vue +++ b/packages/editor-ui/src/components/NodeCredentials.vue @@ -109,20 +109,18 @@ export default mixins( this.node.parameters.authenticateWith === 'genericAuth'; }, credentialTypesNode (): string[] { - return this.credentialTypesNodeDescription + const nodeCredentialTypes = this.credentialTypesNodeDescription .map((credentialTypeDescription) => credentialTypeDescription.name); + + this.$emit('nodeCredentialTypes', nodeCredentialTypes); + + return nodeCredentialTypes; }, credentialTypesNodeDescriptionDisplayed (): INodeCredentialDescription[] { - const descriptions = this.credentialTypesNodeDescription + return this.credentialTypesNodeDescription .filter((credentialTypeDescription) => { return this.displayCredentials(credentialTypeDescription); }); - - if (descriptions.length === 1) { - this.$emit('newActiveCredentialType', descriptions[0].name); - } - - return descriptions; }, credentialTypesNodeDescription (): INodeCredentialDescription[] { const node = this.node as INodeUi; diff --git a/packages/editor-ui/src/components/NodeSettings.vue b/packages/editor-ui/src/components/NodeSettings.vue index b0571a27e5..e0654c3921 100644 --- a/packages/editor-ui/src/components/NodeSettings.vue +++ b/packages/editor-ui/src/components/NodeSettings.vue @@ -50,8 +50,8 @@
@@ -319,30 +319,31 @@ export default mixins( }, methods: { /** - * Check if the node's currently active credential type may be used to make a request with the HTTP Request node v2. + * Check if any of the node's credential types may be used to make a request with the HTTP Request node v2. */ - checkIfSupportedByHttpRequestNode(activeCredentialTypeName: string) { - const credentialType = this.getCredentialTypeByName(activeCredentialTypeName); - - this.isSupportedByHttpRequestNode = ( - credentialType.name.slice(0, -4).endsWith('OAuth') || - credentialType.authenticate !== undefined - ); - }, - async loadScopesNoticeData(activeCredentialType: string) { + checkHttpRequestNodeSupport(credentialTypeNames: string[]) { if (!this.isHttpRequestNodeV2(this.node)) return; - if ( - !activeCredentialType || - !activeCredentialType.endsWith('OAuth2Api') - ) { + this.isSupportedByHttpRequestNode = credentialTypeNames.some(name => { + const credentialType = this.getCredentialTypeByName(name); + + return ( + credentialType.name.slice(0, -4).endsWith('OAuth') || + credentialType.authenticate !== undefined + ); + }); + }, + async prepareScopesNotice(activeCredentialType: string) { + if (!this.isHttpRequestNodeV2(this.node)) return; + + if (!activeCredentialType || !activeCredentialType.endsWith('OAuth2Api')) { this.scopes = []; return; } - this.activeCredential = this.getCredentialTypeByName(activeCredentialType).displayName; - this.scopes = await this.restApi().getScopes(activeCredentialType); + + this.activeCredential = this.getCredentialTypeByName(activeCredentialType).displayName; }, onNodeExecute () { this.$emit('execute');