Using Token Auth in Botpress 11.5


#1

Hi All,

I’m trying to use the debug API:

POST /api/v1/bots/{botId}/converse/{userId}/secured?include=nlu,state,suggestions,decision

as per the docs:

I have updated the Auth token in /src/bp/index.ts like so:

authToken: {
alias: ‘token’,
description: ‘your authorization token on the remote botpress server’,
// tslint:disable-next-line:no-null-keyword
default: ‘1234’,
type: ‘string’
},

But i get a “Unauthorized: Invalid authentication token” error.

Am i setting the auth token in the correct place?

FYI my curl command is:

curl -X POST localhost:3000/api/v1/bots/chat-test1/converse/testUser/secured?include=nlu,state,suggestions,decision --header ‘Authorization: Bearer 1234’ -H “Content-Type: application/json” -d ‘{“type”:“text”, “text”: “appoint a new director”}’

Thanks,
Dan


#2

Are you trying to edit /src/bp/index.ts? I don’t think that’s a good idea.
You can check actual token in browser’s localstorage under bp/token key.