-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error message:authorization config header is required #6033
Comments
Hello, @DDDU123! I'm here to help you with any bugs, questions, or contributions you have for the repository. Let's tackle this issue together! To resolve the "authorization config header is required" error in Dify version 0.6.12-fix1, ensure that the authorization configuration is correctly set up in your HTTP node. Specifically, you need to provide the required header or API key based on the selected authorization type. Here is a step-by-step guide to ensure the correct configuration:
Here is the relevant code snippet to guide you through the process: const handleAuthTypeChange = useCallback((type: string) => {
const newPayload = produce(tempPayload, (draft: AuthorizationPayloadType) => {
draft.type = type as AuthorizationType
if (draft.type === AuthorizationType.apiKey && !draft.config) {
draft.config = {
type: APIType.basic,
api_key: '',
}
}
})
setTempPayload(newPayload)
}, [tempPayload, setTempPayload])
const handleAuthAPITypeChange = useCallback((type: string) => {
const newPayload = produce(tempPayload, (draft: AuthorizationPayloadType) => {
if (!draft.config) {
draft.config = {
type: APIType.basic,
api_key: '',
}
}
draft.config.type = type as APIType
})
setTempPayload(newPayload)
}, [tempPayload, setTempPayload])
const handleAPIKeyOrHeaderChange = useCallback((type: 'api_key' | 'header') => {
return (e: React.ChangeEvent<HTMLInputElement>) => {
const newPayload = produce(tempPayload, (draft: AuthorizationPayloadType) => {
if (!draft.config) {
draft.config = {
type: APIType.basic,
api_key: '',
}
}
draft.config[type] = e.target.value
})
setTempPayload(newPayload)
}
}, [tempPayload, setTempPayload])
const handleConfirm = useCallback(() => {
onChange(tempPayload)
onHide()
}, [tempPayload, onChange, onHide]) Ensure that you provide the necessary class Authorization(BaseModel):
class Config(BaseModel):
type: Literal[None, 'basic', 'bearer', 'custom']
api_key: Union[None, str] = None
header: Union[None, str] = None
type: Literal['no-auth', 'api-key']
config: Optional[Config] = None
@field_validator('config', mode='before')
@classmethod
def check_config(cls, v: Config, values: ValidationInfo):
if values.data['type'] == 'no-auth':
return None
else:
if not v or not isinstance(v, dict):
raise ValueError('config should be a dict')
return v Make sure your configuration adheres to these requirements to resolve the error [1][2]. |
Self Checks
Dify version
0.6.12-fix1
Cloud or Self Hosted
Cloud
Steps to reproduce
I got this error message when running the HTTP node: "authorization config header is required." But everything was working fine before yesterday, and I haven't made any changes to the authorization.


✔️ Expected Behavior
No response
❌ Actual Behavior
No response
The text was updated successfully, but these errors were encountered: