botpress / v12

Botpress OSS – v12
https://v12.botpress.com
GNU Affero General Public License v3.0
68 stars 83 forks source link

Cannot call Converse Debug API #1085

Closed user753 closed 2 years ago

user753 commented 3 years ago

Describe the bug I can login and get token http -v POST http://localhost:3000/api/v1/auth/login/basic/default email=test password=test

 "message": "Login successful",
    "payload": {
        "token": "foobar"
    },
    "status": "success"

But when I try to use it to call debug api

 http -v POST http://localhost:3000/api/v1/bots/testbot/converse/user2?include=state  type=text text=hey Authorization:"Bearer foobar"

I get

Unauthenticated converse API can only return 'responses'

Maybe I don't fully undestand the code, but according to source https://github.com/botpress/botpress/blob/b5050357472f8a47452589d1f5dac434f549450f/src/bp/core/routers/bots/converse.ts#L53 It doesn't check if user authorized or not. I want to get user variables. Can I somehow hot fix it? Or can I create similar rest api by myself that doesn't requred authorization?

Environment (please complete the following information):

BPMJoannette commented 3 years ago

Hi @user753,

Did you perhaps forget to add the /secured route to get debug options? POST /api/v1/bots/testbot/converse/user2/secured?include=nlu,state

Let us know if that works for you!

user753 commented 3 years ago

@BPMJoannette Indeed, thanks. I think this error message is incorrect. It tells that it's unauthenticated, but in reality it cannot be authenticated.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

J-FMartin commented 2 years ago

Hi - fixed, we will close this, please reopen if need be.