OAuth Authorization Code Flow for a chat bot: 401 invalid csrf token

You can’t do machine-to-machine for a Chatbot.

Machine to machine tokens don’t represent a user.
Only users have channel subscriptions.

if you don’t get a refresh token back that type of token cannot be refreshed.

For App Access Tokens (machine to machine) you jsut go make a new token
For user access tokens, you should get a refresh token and can refresh, UNLESS
You did implicit auth, which also cannot be refreshed.

You are using the correct flow, but you need to paint the credentials once manually for the bot account

Which for the record is this flow:

2 Likes