I have used the helm chart and the instructions from here to deploy a test rasa-x setup on my kubernetes cluster. I then added some training data and trained and ran a model.
Now I am trying to use the http api to take actions on this bot, but nothing is working. I’ve tried port-forwarding every single pod/service/deployment to my localhost and tried hitting the api. But I keep getting Unauthorized
. I’ve exec’d into each of the pods and checked the JWT_TOKEN and am passing the same exact token through the api, but no luck.
$ curl -H "Content-Type: application/json" -H "Authorization: Bearer abc123" -X GET localhost:5002/api/conversations?token=abc123 -d '
{
"sender": "sender123",
"message": "Hello"
}'
{"reasons":["Auth required."],"exception":"Unauthorized"}
The only http API I am able to get working is:
$ curl -XGET localhost:5002/api/chatToken?token=abc123
{"chat_token":"33*************","bot_name":"***@***.com","description":"","expires":1592175500}
$ curl -XGET localhost:5002/api/config?token=abc123
{"credentials":"rasa:\n url: http:\/\/rasa-test-release-rasa-x-rasa-x:5002\/api\n","endpoints":"models:\n url: ${RASA_MODEL_SERVER}\n token: ${RASA_X_TOKEN}\n wait_time_between_pulls: 10\ntracker_store:\n type: sql\n dialect: \"postgresql\"\n url: rasa-test-release-postgresql\n port: 5432\n username: postgres\n password: ${DB_PASSWORD}\n db: ${DB_DATABASE}\n login_db: rasa\nevent_broker:\n type: \"pika\"\n url: \"rasa-test-release-rabbit\"\n username: \"user\"\n password: ${RABBITMQ_PASSWORD}\n port: 5672\n queue: ${RABBITMQ_QUEUE}\naction_endpoint:\n url: \"http:\/\/rasa-test-release-rasa-x-app:5055\/webhook\"\n token: \"\"\nlock_store:\n type: \"redis\"\n url: rasa-test-release-redis-master\n port: 6379\n password: ${REDIS_PASSWORD}\n db: 1\n"}
Solution
Turns out the Bearer token I needed to pass was not the JWT_TOKEN I created initially, but was the token I get after running:
curl -H "Content-Type: application/json" -X POST rasa-dev-api-staging.mist.pvt/api/auth -d '
{
"username": "me",
"password": "abc123"
}'