调用云服务的应用API时,总是显示:unauthorized #149

Closed
opened 2026-02-21 17:26:09 -05:00 by yindo · 11 comments
Owner

Originally created by @smallanything on GitHub (Jun 9, 2023).

curl --location --request POST 'https://api.dify.dev/v1/chat-messages'
--header 'Authorization: Bearer app-zvdXk****************'
--header 'Content-Type: application/json'
--data-raw '{
"inputs": {},
"query": "eh",
"response_mode": "streaming",
"conversation_id": "1c7e55fb-1ba2-4e10-81b5-30addcea2276"
"user": "abc-123"
}'

我通过这个在网页端进行调用,但一直反馈失败
"code": "unauthorized",
"message": "The server could not verify that you are authorized to access the URL requested. You either supplied the wrong credentials (e.g. a bad password), or your browser doesn't understand how to supply the credentials required.",
"status": 401
}

求问如何解决

Originally created by @smallanything on GitHub (Jun 9, 2023). curl --location --request POST 'https://api.dify.dev/v1/chat-messages' \ --header 'Authorization: Bearer app-zvdXk****************' \ --header 'Content-Type: application/json' \ --data-raw '{ "inputs": {}, "query": "eh", "response_mode": "streaming", "conversation_id": "1c7e55fb-1ba2-4e10-81b5-30addcea2276" "user": "abc-123" }' 我通过这个在网页端进行调用,但一直反馈失败 "code": "unauthorized", "message": "The server could not verify that you are authorized to access the URL requested. You either supplied the wrong credentials (e.g. a bad password), or your browser doesn't understand how to supply the credentials required.", "status": 401 } 求问如何解决
yindo closed this issue 2026-02-21 17:26:09 -05:00
Author
Owner

@smallanything commented on GitHub (Jun 9, 2023):

我直接用postman调用,反馈是:
{ "code": "bad_request", "status": 400, "message": "The browser (or proxy) sent a request that this server could not understand." }

@smallanything commented on GitHub (Jun 9, 2023): 我直接用postman调用,反馈是: { "code": "bad_request", "status": 400, "message": "The browser (or proxy) sent a request that this server could not understand." }
Author
Owner

@crazywoola commented on GitHub (Jun 9, 2023):

Try to make conversation_id: null if you are call it first time.

@crazywoola commented on GitHub (Jun 9, 2023): Try to make `conversation_id: null` if you are call it first time.
Author
Owner

@smallanything commented on GitHub (Jun 9, 2023):

thanks, but I have tried from your suggestion,but here is the result :(

curl --location --request POST 'https://api.dify.dev/v1/chat-messages'
--header 'Authorization: Bearer app-***************'
--header 'Content-Type: application/json'
--data-raw '{
"inputs": {},
"query": "eh",
"response_mode": "streaming",
"conversation_id": null
"user": “dify”
}'
{
"code": "unauthorized",
"message": "The server could not verify that you are authorized to access the URL requested. You either supplied the wrong credentials (e.g. a bad password), or your browser doesn't understand how to supply the credentials required.",
"status": 401
}

@smallanything commented on GitHub (Jun 9, 2023): > thanks, but I have tried from your suggestion,but here is the result :( curl --location --request POST 'https://api.dify.dev/v1/chat-messages' \ --header 'Authorization: Bearer app-***************' \ --header 'Content-Type: application/json' \ --data-raw '{ "inputs": {}, "query": "eh", "response_mode": "streaming", "conversation_id": null "user": “dify” }' { "code": "unauthorized", "message": "The server could not verify that you are authorized to access the URL requested. You either supplied the wrong credentials (e.g. a bad password), or your browser doesn't understand how to supply the credentials required.", "status": 401 }
Author
Owner

@takatost commented on GitHub (Jun 9, 2023):

I think I found that there's a missing comma after "conversation_id": null

@takatost commented on GitHub (Jun 9, 2023): I think I found that there's a missing comma after "conversation_id": null
Author
Owner

@smallanything commented on GitHub (Jun 9, 2023):

There is the same result:unauthorized

curl --location --request POST 'https://api.dify.dev/v1/chat-messages'
--header 'Authorization: Bearer app-**************'
--header 'Content-Type: application/json'
--data-raw '{
"inputs": {},
"query": "eh",
"response_mode": "streaming",
"conversation_id": null,
"user": “dify”
}'
{
"code": "unauthorized",
"message": "The server could not verify that you are authorized to access the URL requested. You either supplied the wrong credentials (e.g. a bad password), or your browser doesn't understand how to supply the credentials required.",
"status": 401
}

@smallanything commented on GitHub (Jun 9, 2023): There is the same result:unauthorized > curl --location --request POST 'https://api.dify.dev/v1/chat-messages' \ --header 'Authorization: Bearer app-**************' \ --header 'Content-Type: application/json' \ --data-raw '{ "inputs": {}, "query": "eh", "response_mode": "streaming", "conversation_id": null, "user": “dify” }' { "code": "unauthorized", "message": "The server could not verify that you are authorized to access the URL requested. You either supplied the wrong credentials (e.g. a bad password), or your browser doesn't understand how to supply the credentials required.", "status": 401 }
Author
Owner

@takatost commented on GitHub (Jun 10, 2023):

The domain you filled in is wrong, it should be https://api.dify.ai/

@takatost commented on GitHub (Jun 10, 2023): The domain you filled in is wrong, it should be `https://api.dify.ai/`
Author
Owner

@smallanything commented on GitHub (Jun 10, 2023):

I have changed the domain, but the result is : { "code": "bad_request", "status": 400, "message": "The browser (or proxy) sent a request that this server could not understand." }

@smallanything commented on GitHub (Jun 10, 2023): > I have changed the domain, but the result is : { "code": "bad_request", "status": 400, "message": "The browser (or proxy) sent a request that this server could not understand." }
Author
Owner

@kmfish commented on GitHub (Jul 26, 2023):

I have changed the domain, but the result is : { "code": "bad_request", "status": 400, "message": "The browser (or proxy) sent a request that this server could not understand." }

me too...

@kmfish commented on GitHub (Jul 26, 2023): > > > > I have changed the domain, but the result is : { "code": "bad_request", "status": 400, "message": "The browser (or proxy) sent a request that this server could not understand." } me too...
Author
Owner

@xmsz-stu commented on GitHub (Jan 24, 2024):

The browser (or proxy) sent a request that this server could not understand. 有人解决了吗

@xmsz-stu commented on GitHub (Jan 24, 2024): The browser (or proxy) sent a request that this server could not understand. 有人解决了吗
Author
Owner

@losdwind commented on GitHub (Feb 5, 2024):

image

@losdwind commented on GitHub (Feb 5, 2024): ![image](https://github.com/langgenius/dify/assets/4186909/d60f1748-1669-4cee-990a-e0461242ec2b)
Author
Owner

@v-49 commented on GitHub (Dec 31, 2024):

every different app`s key is different, i think thats the key

@v-49 commented on GitHub (Dec 31, 2024): every different app`s key is different, i think thats the key
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#149