Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix basic auth encoding (#18047)

kenwoodjwdfc123819e58
diff --git a/api/core/workflow/nodes/http_request/executor.py b/api/core/workflow/nodes/http_request/executor.py
index bf28222de08..f7fa8d670c8 100644
--- a/api/core/workflow/nodes/http_request/executor.py
+++ b/api/core/workflow/nodes/http_request/executor.py
@@ -1,3 +1,4 @@
+import base64
import json
from collections.abc import Mapping
from copy import deepcopy
@@ -259,7 +260,9 @@ class Executor:
if self.auth.config.type == "bearer":
headers[authorization.config.header] = f"Bearer {authorization.config.api_key}"
elif self.auth.config.type == "basic":
- headers[authorization.config.header] = f"Basic {authorization.config.api_key}"
+ credentials = authorization.config.api_key
+ encoded_credentials = base64.b64encode(credentials.encode("utf-8")).decode("utf-8")
+ headers[authorization.config.header] = f"Basic {encoded_credentials}"
elif self.auth.config.type == "custom":
headers[authorization.config.header] = authorization.config.api_key or ""